spacetelescope / acsql

The Advanced Camera for Surveys Quicklook Project
BSD 3-Clause "New" or "Revised" License
6 stars 1 forks source link

Queries #14

Closed SaOgaz closed 7 years ago

SaOgaz commented 7 years ago
  1. for a given rootname give me all the filenames

query.(Master.rootname, wfc_asn_0.filename, wfc_flt_0.filename,.....)\ .join(wfc_asn_0)\ .join(wfc_flt_0)\

  1. for a given rootname, what filters were used?

query.(Master.rootname=input_rootame, wfc_raw_0.filter1, wfc_raw_0.filter2)\ .join(wfc_raw_0)\ .distinct()

  1. return filter distribution for full DB better way to do this in one SQL query...

query to get all filter tuples

query.(wfc_raw_0.filter1, wfc_raw_0.filter2)\ .distinct()

query number of wfc_raw_0 entries

Loop through all combos, query combo, divide by # of table entries

  1. list root names taken for particular target session.query(wfc_raw_0.rootname, wfc_raw_0.filename, wfc_raw_0.targname)\ .filter(wfc_raw_0.targname==input_target)

  2. list filenames using a particular dark file. session.query(wfc_raw_0.filename)\ .filter(wfc_raw_0.darkfile == input_dark)

  3. print out GOODMEAN for SCI extensions in proposal set or visit or rootname q6 = session.query(Master.rootname, WFC_flt_1.goodmean,WFC_flt_4.goodmean).filter(Master.rootname.like('jcqp%')).join(WFC_flt_1).join(WFC_flt_4)

  4. get rootnames for observations with FLASHDUR > 0, that’s not a dark session.query(Master.rootname, WFC_raw_0.flashdur).filter(WFC_raw_0.flashdur > 0).filter(WFC_raw_0.targname != 'DARK').join(WFC_raw_0)

  5. get rootnames that DON”T have an association

initial query of what's in association

assoc_names = query(Master.rootname).join(wfc_asn_0)\

now actual query

query(master.rootname)\ .join(wfc_asn0)\ .filter(~master.rootname.in(assoc_names))

qq = session.query(Master.rootname).filter(~exists().where(and_(Master.rootname == WFC_asn_0.rootname)))

  1. get associations from particular Day Date Range

date_obs = getattr(WFC_raw_0, 'date-obs') q9 = session.query(WFC_asn_0.filename).filter(date_obs >= '2014-06-01').filter(date_obs <= '2014-06-10')

bourque commented 7 years ago

Implemented in 6548a1e9d6193d77f9657560787ef3940587f9aa