Skip to content

Commit

Permalink
copilot plot: dRA,dDec label position
Browse files Browse the repository at this point in the history
  • Loading branch information
dstndstn committed Apr 4, 2017
1 parent dcf71f7 commit 96e372e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
21 changes: 10 additions & 11 deletions copilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand All @@ -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)

Expand All @@ -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')
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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,
Expand Down
18 changes: 15 additions & 3 deletions update-obstatus.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 96e372e

Please sign in to comment.