![]() |
|
#1
|
|||
|
|||
![]()
On Mon, 30 Jun 2003 23:58:18 +0000, Allan Adler wrote:
Using data from the Sloan Digital Sky Survey, I created a table with 10 entries as follows: CREATE TABLE top10(objID int(64), I think I'd make that an unsigned int so that you get all the digits you think you want. You're missing one this way, I believe. skyversion int(5), run int(16), rerun int(11), camcol int(3), field int(13), obj int(16)); snip That worked fine. Now, suppose I wanted to do it all differently. Specifically, suppose I only wanted the file top10.txt to contain the first column entries (i.e. the bigints) and to instead compute the other columns from the first column. Bits 0 through 15 represent the integer in the "obj" column. Bits 16 through 28 represent the integer in the "field" column. Bits 29-31 represent the integer in the "camcol" column. Bits 32-47 represent the integer in the "run" column. Bits 48-58 represent the integer in the "rerun" column. Bits 59-63 represent the integer in thee "skyversion" column. What exactly should the command be to fill in the table with the given values in the first column and the computed values in the other columns? I assume that you're numbering these bits from left to right, most significant to least, which is a little odd, but I think that's the way this astronomical deal is actually done. Correct me if I'm wrong. (actually, don't correct me, but just learn from the explanation below and apply it differently) To get the skyversion, you want the 4 least significant bits, so && the objID with 0x0000000F: "select objID && 15 from top10". To get the "rerun" column, shift your objID 4 bits right (to get rid of the "skyversion" bits) and then take the 11 least significant bits: select 4095 && (objID 4). To get the "run" column, you want to shift off 15 bits (4 + 11) to the right, then take the 16 least significant bits. To get the obj column, you only need shift off to the right all but the last 16 bits, so that's select objID 48. All that may be wrong, but that's the way I'd try it at first, at least. Good luck! -pb |
Thread Tools | |
Display Modes | |
|
|