********************* Exploring the Dataset ********************* This guide is written with a GMOS MOS dataset in mind. But components should also work for future parts of this framework. To load the database >>> from geminiutil import gmos, base >>> proj = gmos.GMOSMOSProject('sqlite:///mcsnr.db3') >>> Each FITS file has an entry in the database as ~FITSFile and we can query the FITS files: >>> test_fits = proj.session.query(base.FITSFile).first() >>> test_fits >>> test_fits.path, test_fits.fname (u'/media/data1/mcsnr/gmos_data/raw', u'GS20121011S0254_BIAS.fits') All FITS files that are actually recorded with the detector have an entry at ~GMOSMOSRawFITS. This object links back to the FITSFile: >>> test_fits.raw_fits >>> test_fits.mjd 56211.447782407406 All raw fits entries are linked to a type and class. We can find all types and classes >>> proj.observation_classes (u'daycal', u'acq', u'science', u'partnercal', u'acqcal', u'progcal') >>> proj.observation_types (u'bias', u'flat', u'object', u'arc') We can also query for raw fits files that belong to a particular type >>> proj.session.query(gmos.GMOSMOSRawFITS).join(base.ObservationClass).filter(base.ObservationClass.name=='science').first() There are short cuts to do those queries: >>> proj.science [, , , , ... ] >>> proj.flat [, , , ... ] If you would like to get the query item back to do more filtering on your query that is also possible: >>> test_fits = proj.science_query.filter_by(gmos.GMOSMOSRawFITS.mjd > 56215.).first() >>> test_fits >>> test_fits.mjd 56234.21007291666 Instrument Setup ^^^^^^^^^^^^^^^^ Each GMOSMOSRawFITS is also linked to an InstrumentSetup that knows about how GMOS was setup >>> isetup = test_fits.instrument_setup >>> isetup >>> isetup.instrument