diff --git a/copilot.py b/copilot.py index bfbc70a..cb7b884 100755 --- a/copilot.py +++ b/copilot.py @@ -576,6 +576,12 @@ def limitstyle(band): dra = (CD[:,0] * Tx.dx + CD[:,1] * Tx.dy) * 3600. ddec = (CD[:,2] * Tx.dx + CD[:,3] * Tx.dy) * 3600. + mx = np.percentile(np.abs(np.append(dra, ddec)), 95) + # make the range at least +- 10 arcsec. + mx = max(mx, 10) + mx *= 1.2 + yl,yh = -mx,mx + refdra,refddec = None,None print('Camera', Tx.camera[0]) if Tx.camera[0].strip() == 'mosaic3': @@ -602,7 +608,7 @@ def limitstyle(band): if not nightly: mjd = Tx.mjd_obs[I[-1]] r,d = refdra[I[-1]], refddec[I[-1]] - yl,yh = plt.ylim() + plt.text(mjd, yl+0.03*(yh-yl), '(%.1f, %.1f)' % (r,d), ha='center', bbox=bbox) @@ -612,18 +618,11 @@ def limitstyle(band): pr = plt.plot(Tx.mjd_obs, dra, 'b-', alpha=0.5) pd = plt.plot(Tx.mjd_obs, ddec, 'g-', alpha=0.5) #plt.legend((pr[0], pd[0]), ('RA', 'Dec')) - yl,yh = plt.ylim() - mx = np.percentile(np.abs(np.append(dra, ddec)), 95) - # make the range at least +- 10 arcsec. - mx = max(mx, 10) - mx *= 1.2 - plt.axhline(0.0, color='k', alpha=0.5) plt.axhline(+10., color='k', alpha=0.2) plt.axhline(-10., color='k', alpha=0.2) - plt.ylim(-mx,mx) - + # i = np.argmax(T.mjd_obs) # plt.text(T.mjd_obs[i], dra[i], ' RA', ha='left', va='center') # plt.text(T.mjd_obs[i], ddec[i], ' Dec', ha='left', va='center') @@ -664,10 +663,10 @@ def limitstyle(band): if refdra is None and not nightly: # If refdra is available, only label that. - yl,yh = plt.ylim() plt.text(Tx.mjd_obs[-1], yl+0.03*(yh-yl), '(%.1f, %.1f)' % (dra[-1], ddec[-1]), ha='center', bbox=bbox) + plt.ylim(yl, yh) plt.ylabel('dRA (blu), dDec (grn)') plt.xlabel('MJD') @@ -1382,7 +1381,7 @@ def main(cmdlineargs=None, get_copilot=False): help='Save plot to given file, default %s' % plotfn_default) parser.add_option('--nightplot', '--night', action='store_true', - help="Plot tonight's data and quit") + help="Plot tonight's data and quit", default=False) parser.add_option('--ago', type=int, help='Plot N nights ago; with --night') parser.add_option('--qa-plots', dest='doplots', default=False, diff --git a/update-obstatus.py b/update-obstatus.py index 34d187b..7b1fafb 100644 --- a/update-obstatus.py +++ b/update-obstatus.py @@ -50,6 +50,9 @@ def main(): obsdb.django_setup(database_filename=database_filename) ccds = obsdb.MeasuredCCD.objects.all() copilot = db_to_fits(ccds) + + copilot.writeto('copilot.fits') + print(len(copilot), 'measured CCDs in copilot database') copilot.cut(copilot.expnum > 0) print(len(copilot), 'measured CCDs in copilot database with EXPNUM') @@ -90,7 +93,7 @@ def main(): # And copilot database fix_expnums(copilot.expnum) - print('Z_EXPNUM range:', O.z_expnum.min(), O.z_expnum.max()) + print('Z_EXPNUM range:', O.z_expnum.min(), 'min >0:', O.z_expnum[O.z_expnum > 0].min(), O.z_expnum.max()) # *after* fixing tileids allccds = ccds.copy() @@ -159,6 +162,9 @@ def main(): E.photometric[j] = np.all(ccds.photometric[I]) if len(np.unique(ccds.photometric[I])) == 2: print('Exposure', expnum, 'has photometric and non-photometric CCDs') + print(' ccdnames:', ccds.ccdname[I]) + print(' photometric:', ccds.photometric[I]) + print(' depth:', ccds.galdepth[I]) # Don't include zeros in computing average depths! Igood = I[ccds.galdepth[I] > 0] if len(Igood) > 0: @@ -389,9 +395,15 @@ def main(): (O.get('%s_done' % band) == 1) * (O.in_desi == 1)) print(len(I2), 'with EXPNUM and DONE and IN_DESI, but no DEPTH') - print('Exposure numbers:', O.get('%s_expnum' % band)[I2]) # Sort by expnum - # I2 = I2[np.argsort(O.get('%s_expnum' % band)[I2])] + I2 = I2[np.argsort(O.get('%s_expnum' % band)[I2])] + print('Exposure numbers:', sorted(O.get('%s_expnum' % band)[I2])) + print('Dates:', sorted(O.get('%s_date' % band)[I2])) + print('Dates:', np.unique(O.get('%s_date' % band)[I2])) + + for i in I2: + print(' date', O.get('%s_date' % band)[i], 'expnum', O.get('%s_expnum' % band)[i]) + # for i2,o in zip(I2, O[I2]): # print() # e = o.get('%s_expnum' % band)