dkirkby / bossdata

Tools for accessing SDSS BOSS data
MIT License
1 stars 3 forks source link

Add support for BOSS quasar catalogs #42

Closed dmargala closed 9 years ago

dmargala commented 9 years ago

This is about the minimum amount of work I could possibly have done to perform queries on the DR12Q catalog via boss query (see #11 ).

A user can perform queries on the quasar catalog using the --quasar-catalog option. Note that --full also needs to specified because there is no (documented) lite version of the quasar catalog. For example:

$ bossquery --verbose --print --full --quasar-catalog --what PLATE,MJD,FIBER,RA,DEC,Z_VI,Z_PIPE --where "" --print --max-rows 10
Database contains 297301 rows.
Query returned 10 rows.
PLATE  MJD  FIBER        RA             DEC            Z_VI         Z_PIPE   
----- ----- ----- ---------------- -------------- ------------- -------------
 6173 56238   528 0.00189828518376  17.7737391299 2.30909729004 2.30909729004
 6177 56268   595 0.00275643009297  14.9746754937 2.49794077873 2.49794077873
 4415 55831   464 0.00405238853989  4.82978057467 1.61884605885 1.61884605885
 4354 55810   678 0.00531697386447 -2.03327328857 1.36035752296 1.36035752296
 4354 55810   646 0.00574621499496 -1.32500879187         2.328 2.33265471458
 6110 56279    86 0.00591211508117  20.0122584631          3.09 3.08883881569
 6498 56565   177  0.0068187989383  30.5193561212         2.377 2.37329888344
 7147 56574   158 0.00735938662115 -7.48592663047         2.538 2.54230260849
 6177 56268   608  0.0075785472626  14.1973854462 3.71199345589 3.71199345589
 4216 55477   312 0.00806669135031 -0.24097078526         2.163 2.16455936432
dkirkby commented 9 years ago

I would make the catalog name an optional parameter to the new path method, the Database ctor, and bossquery. Unfortunately this means repeating the same default value 3 times, which is not very DRY, but we can fix that by adding a get_default_quasar_catalog_name as a @staticmethod of path.Finder. What do you think?

dkirkby commented 9 years ago

I didn't realize it would be so easy to leverage the existing create_meta_full functionality for the quasar catalog - nice! (but perhaps we should rename that method now to create_meta_from_fits ?)

dkirkby commented 9 years ago

Are there any issues with naming inconsistencies between spAll and the quasar catalog that we should try to normalize (e.g., using the renaming_rules arg to sql_table_create) so that these two catalogs give consistent results for queries that they can both handle?

dmargala commented 9 years ago

Okay, I can try to do something like that. If there is a default value for the quasar catalog name, though, how will the Database ctor / bossquery know when to use the quasar catalog and when to use the spAll file? It seems like you would need another argument?

There are a few places where sp_all_path is used and perhaps can be renamed to catalog_path.

I haven't looked at all the keywords yet but the obvious one is Z vs Z_PIPE.

dkirkby commented 9 years ago

We need two parameters to cover all the bases:

bool: quasar_catalog = False
str: quasar_catalog_name = bossdata.path.Finder.default_quasar_catalog_name

I agree with renaming sp_all_path to catalog_path in cases where it might be either spAll or the quasar catalog.

I would probably leave Z_PIPE as is, to make it clear that you have to chose between Z_PIPE and Z_VIS when using the quasar catalog.

dkirkby commented 9 years ago

@dmargala Can we close this one today? (since it makes it much easier to find SDSS-BOSS repeat quasar observations).

dmargala commented 9 years ago

@dkirkby How does that look? If everything is okay I will add a few lines in script.rst to document usage and then merge.

dkirkby commented 9 years ago

@dmargala Go ahead and merge when you are ready.

dmargala commented 9 years ago

The recent changes to meta.py complicate this merge.

dmargala commented 9 years ago

The lite/full logic in the Database object initialization is more complicated now. I just wrapped the recent changes with:

if quasar_catalog:
    ...create db...
else:
   ...complicated lite/full create db...

to avoid breaking anything.

dkirkby commented 9 years ago

I snuck a fix for #36 into my last commit