Skip to content

Commit

Permalink
Changing tests (note: this is broken)
Browse files Browse the repository at this point in the history
  • Loading branch information
dryczanowski committed Jul 18, 2024
1 parent 1afd386 commit 503d921
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/models/test_image_querying.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ def test_image_query(ptf_ref, decam_reference, decam_datastore, decam_default_ca
# assert results4[1].type == 'Sci' # the second one is the regular image
assert results4[0].type == 'Sci' # the first one out is the regular image
assert results4[1].type == 'ComSci' # the second one is the high quality coadd

# import pdb; pdb.set_trace()
# check that the DECam difference and new image it is based on have the same limiting magnitude and quality
stmt = Image.query_images(instrument='DECam', type=3)
diff = session.scalars(stmt).first()
Expand Down
29 changes: 29 additions & 0 deletions tests/models/test_measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,35 @@ def test_measurements_attributes(measurer, ptf_datastore, test_config):
#check the limiting magnitude is consistent with previous runs
assert limMagEst == pytest.approx(20.00, abs=0.5)

from pipeline.data_store import DataStore
ds = DataStore(image_id=1126)
im = ds.get_image()
sl = ds.get_sources()
# import pdb; pdb.set_trace()
limMagResults = sl.estimate_lim_mag(aperture=1, givePlotParams=True)
limMagEst = limMagResults[0]
snrs = limMagResults[1]
mags = limMagResults[2]
grad = limMagResults[3]
intercept = limMagResults[4]

xdata = np.linspace(np.log(3),np.log(20),1000)
plt.plot(snrs,mags,linewidth=0,marker='o',c='midnightblue')
plt.plot(xdata, grad * xdata + intercept, c='firebrick')
plt.xlabel('log SNR')
plt.ylabel('magnitude')
plt.title('Limiting magntiude = {:.2f} mag'.format(limMagEst))
ymin,ymax = plt.gca().get_ylim()
plt.vlines(x=np.log(5),ymin=ymin,ymax=ymax)
plt.hlines(y=limMagEst,xmin=np.log(3),xmax=np.log(20))
plt.xlim(np.log(3),np.log(20))
plt.ylim(ymin,ymax)
plt.savefig('plots/snr_mag_plot.png')
plt.show()
# import pdb; pdb.set_trace()





def test_filtering_measurements(ptf_datastore):
Expand Down

0 comments on commit 503d921

Please sign in to comment.