diff --git a/tests/models/test_image_querying.py b/tests/models/test_image_querying.py index 5bd8ec51..7534dd1a 100644 --- a/tests/models/test_image_querying.py +++ b/tests/models/test_image_querying.py @@ -712,7 +712,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() + 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() diff --git a/tests/models/test_measurements.py b/tests/models/test_measurements.py index adf7faf9..6d7c6d63 100644 --- a/tests/models/test_measurements.py +++ b/tests/models/test_measurements.py @@ -119,33 +119,36 @@ def test_measurements_attributes(measurer, ptf_datastore, test_config): 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() + from models.source_list import SourceList + from models.base import SmartSession + with SmartSession() as session: + ds = DataStore(image_id=1126) + im = ds.get_image() + # sl = ds.get_sources() + sl = (session.query( SourceList ).filter( SourceList.image_id==1126 ).all())[0] + 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_db.png') + plt.show() + # import pdb; pdb.set_trace()