From 8453ec245c08b013cb7869632b1e6ac4a7df009a Mon Sep 17 00:00:00 2001 From: duncandc Date: Mon, 4 Dec 2017 11:06:54 -0800 Subject: [PATCH 01/74] added test file --- descqa/apparant_mag_func_test.py | 59 ++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 descqa/apparant_mag_func_test.py diff --git a/descqa/apparant_mag_func_test.py b/descqa/apparant_mag_func_test.py new file mode 100644 index 00000000..51fcf8a4 --- /dev/null +++ b/descqa/apparant_mag_func_test.py @@ -0,0 +1,59 @@ +from __future__ import unicode_literals, absolute_import, division +import os +import numpy as np +from .base import BaseValidationTest, TestResult +from .plotting import plt + + +__all__ = ['ExampleTest'] + +class ExampleTest(BaseValidationTest): + """ + An example validation test + """ + def __init__(self, **kwargs): + + # load test config options + self.kwargs = kwargs + self.option1 = kwargs.get('option1', 'option1_default') + self.option2 = kwargs.get('option2', 'option2_default') + self.test_name = kwargs.get('test_name', 'example_test') + + # load validation data + with open(os.path.join(self.data_dir, 'README.md')) as f: + self.validation_data = f.readline().strip() + + # prepare summary plot + self.summary_fig, self.summary_ax = plt.subplots() + + + def post_process_plot(self, ax): + ax.text(0.05, 0.95, self.validation_data) + ax.legend() + + + def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): + + # check if needed quantities exist + if not catalog_instance.has_quantities(['ra', 'dec']): + return TestResult(skipped=True, summary='do not have needed quantities') + + data = np.random.rand(10) #do your calculation with catalog_instance + + fig, ax = plt.subplots() + + for ax_this in (ax, self.summary_ax): + ax_this.plot(data, label=catalog_name) + + self.post_process_plot(ax) + fig.savefig(os.path.join(output_dir, 'plot.png')) + plt.close(fig) + + score = data[0] #calculate your summary statistics + return TestResult(score, passed=True) + + + def conclude_test(self, output_dir): + self.post_process_plot(self.summary_ax) + self.summary_fig.savefig(os.path.join(output_dir, 'summary.png')) + plt.close(self.summary_fig) From bd6ada393891999ab20d7f7ad85a9de29ec8ef44 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Mon, 4 Dec 2017 14:39:36 -0600 Subject: [PATCH 02/74] first pass at test --- descqa/apparant_mag_func_test.py | 77 +++++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 21 deletions(-) diff --git a/descqa/apparant_mag_func_test.py b/descqa/apparant_mag_func_test.py index 51fcf8a4..02ce2630 100644 --- a/descqa/apparant_mag_func_test.py +++ b/descqa/apparant_mag_func_test.py @@ -5,23 +5,39 @@ from .plotting import plt -__all__ = ['ExampleTest'] +__all__ = ['ApparentMagFuncTest'] -class ExampleTest(BaseValidationTest): +class ApparentMagFuncTest(BaseValidationTest): """ - An example validation test + apparent magnitude function test """ - def __init__(self, **kwargs): - - # load test config options - self.kwargs = kwargs - self.option1 = kwargs.get('option1', 'option1_default') - self.option2 = kwargs.get('option2', 'option2_default') - self.test_name = kwargs.get('test_name', 'example_test') - - # load validation data - with open(os.path.join(self.data_dir, 'README.md')) as f: - self.validation_data = f.readline().strip() + def __init__(self, band='i', band_lim=27, observation=none, **kwargs): + """ + parameters + ---------- + band : string + photometric band + + band_lim : float + apparent magnitude upper magnitude limit + """ + + #catalog quantities + possible_mag_fields = ('mag_{}_lsst', + 'mag_{}_sdss', + 'mag_{}_des', + ) + self.possible_mag_fields = [f.format(band) for f in possible_mag_fields] + self.band = band + self.band_lim = band_lim + + #check for validation observations + if not observation: + print('Warning: no data file supplied, no observation requested; only catalog data will be shown') + elif observation not in possible_observations: + raise ValueError('Observation {} not available'.format(observation)) + else: + self.validation_data = self.get_validation_data(band, observation) # prepare summary plot self.summary_fig, self.summary_ax = plt.subplots() @@ -34,19 +50,38 @@ def post_process_plot(self, ax): def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): - # check if needed quantities exist - if not catalog_instance.has_quantities(['ra', 'dec']): - return TestResult(skipped=True, summary='do not have needed quantities') - - data = np.random.rand(10) #do your calculation with catalog_instance + mag_field_key = catalog_instance.first_available(*self.possible_mag_fields) + if not mag_field: + return TestResult(skipped=True, summary='Missing requested quantities') + + #retreive data + d = gc.get_quantities([mag_field_key]) + m = d[mag_field_key] + m = np.sort(m) #put into order--bright to faint + + #caclulate cumulative number of galaxies less than band_lim + mask = (m < self.band_lim) + N_tot = np.sum(mask) + N = np.cumsum(np.ones(N_tot)) + + #define magnitude bins for plotting purposes + self.dmag = 0.1 + self.max_mag = mag_lim + 1.0 + self.min_mag = 17.7 + mag_bins = np.arange(self.min_mag ,self.max_mag, self.dmag) + + #calculate N at the specified points + inds = np.searchsorted(m,mag_bins) + sampled_N = N[inds] fig, ax = plt.subplots() for ax_this in (ax, self.summary_ax): - ax_this.plot(data, label=catalog_name) + ax_this.plot(mag_bins, sampled_N, label=catalog_name) + ax_this.plot(self.band_lim, N_tot) self.post_process_plot(ax) - fig.savefig(os.path.join(output_dir, 'plot.png')) + fig.savefig(os.path.join(output_dir, 'cumulative_app_mag_plot.png')) plt.close(fig) score = data[0] #calculate your summary statistics From 1a73e1f9850ecee1024810919c78920020506a6a Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Mon, 4 Dec 2017 14:57:41 -0600 Subject: [PATCH 03/74] added config file --- descqa/configs/ApparentMagFunc.yaml | 1 + 1 file changed, 1 insertion(+) create mode 100644 descqa/configs/ApparentMagFunc.yaml diff --git a/descqa/configs/ApparentMagFunc.yaml b/descqa/configs/ApparentMagFunc.yaml new file mode 100644 index 00000000..2c58b6e7 --- /dev/null +++ b/descqa/configs/ApparentMagFunc.yaml @@ -0,0 +1 @@ +subclass_name: basic_test.ApparentMagFuncTest \ No newline at end of file From a3352e179ea926fdad1c37c9f33f79557041b824 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Mon, 4 Dec 2017 14:59:10 -0600 Subject: [PATCH 04/74] added config file --- descqa/configs/{ApparentMagFunc.yaml => ApparentMagFuncTest.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename descqa/configs/{ApparentMagFunc.yaml => ApparentMagFuncTest.yaml} (100%) diff --git a/descqa/configs/ApparentMagFunc.yaml b/descqa/configs/ApparentMagFuncTest.yaml similarity index 100% rename from descqa/configs/ApparentMagFunc.yaml rename to descqa/configs/ApparentMagFuncTest.yaml From 84c97ea5389ca304bd8643c2546a802ffc8db873 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Mon, 4 Dec 2017 15:13:19 -0600 Subject: [PATCH 05/74] fixed config bug --- descqa/configs/ApparentMagFuncTest.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descqa/configs/ApparentMagFuncTest.yaml b/descqa/configs/ApparentMagFuncTest.yaml index 2c58b6e7..57472ea7 100644 --- a/descqa/configs/ApparentMagFuncTest.yaml +++ b/descqa/configs/ApparentMagFuncTest.yaml @@ -1 +1 @@ -subclass_name: basic_test.ApparentMagFuncTest \ No newline at end of file +subclass_name: apparent_mag_func_test.ApparentMagFuncTest \ No newline at end of file From 855ae22321e637f38e7d7721c8f437bc1f30d4f2 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Mon, 4 Dec 2017 15:15:15 -0600 Subject: [PATCH 06/74] renamed test --- descqa/{apparant_mag_func_test.py => apparent_mag_func_test.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename descqa/{apparant_mag_func_test.py => apparent_mag_func_test.py} (100%) diff --git a/descqa/apparant_mag_func_test.py b/descqa/apparent_mag_func_test.py similarity index 100% rename from descqa/apparant_mag_func_test.py rename to descqa/apparent_mag_func_test.py From 389677e85e2110a140168f2d2ae3933acddb82bb Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Mon, 4 Dec 2017 15:19:51 -0600 Subject: [PATCH 07/74] fixed bug --- descqa/apparent_mag_func_test.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 02ce2630..b1118b75 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -44,8 +44,7 @@ def __init__(self, band='i', band_lim=27, observation=none, **kwargs): def post_process_plot(self, ax): - ax.text(0.05, 0.95, self.validation_data) - ax.legend() + pass def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): From 90acc0ec25acc526ea63c0d7e50f39e6ed554cdd Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Mon, 4 Dec 2017 15:20:29 -0600 Subject: [PATCH 08/74] fixed bug --- descqa/apparent_mag_func_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index b1118b75..3519decb 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -11,7 +11,7 @@ class ApparentMagFuncTest(BaseValidationTest): """ apparent magnitude function test """ - def __init__(self, band='i', band_lim=27, observation=none, **kwargs): + def __init__(self, band='i', band_lim=27, observation=None, **kwargs): """ parameters ---------- From 9ff0c121d0b848b664f5a84522d2328fd2d5d263 Mon Sep 17 00:00:00 2001 From: duncandc Date: Mon, 4 Dec 2017 13:20:55 -0800 Subject: [PATCH 09/74] fixed typo --- descqa/apparent_mag_func_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 02ce2630..228c0da3 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -11,7 +11,7 @@ class ApparentMagFuncTest(BaseValidationTest): """ apparent magnitude function test """ - def __init__(self, band='i', band_lim=27, observation=none, **kwargs): + def __init__(self, band='i', band_lim=27, observation=None, **kwargs): """ parameters ---------- From 148c18440321e081e779e21811c1ebdaadadfce6 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 7 Dec 2017 10:11:16 -0600 Subject: [PATCH 10/74] working on it! --- descqa/apparent_mag_func_test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 3519decb..3fdd4d82 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -76,8 +76,9 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): fig, ax = plt.subplots() for ax_this in (ax, self.summary_ax): - ax_this.plot(mag_bins, sampled_N, label=catalog_name) + ax_this.plot(mag_bins, sampled_N, 'o', label=catalog_name) ax_this.plot(self.band_lim, N_tot) + ax_this.yscale('log') self.post_process_plot(ax) fig.savefig(os.path.join(output_dir, 'cumulative_app_mag_plot.png')) From 718bc389f47f140e072652d35fed00c88cb9f274 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 7 Dec 2017 10:12:32 -0600 Subject: [PATCH 11/74] added config file --- descqa/configs/ApparentMagFunc.yaml | 1 + 1 file changed, 1 insertion(+) create mode 100644 descqa/configs/ApparentMagFunc.yaml diff --git a/descqa/configs/ApparentMagFunc.yaml b/descqa/configs/ApparentMagFunc.yaml new file mode 100644 index 00000000..2c58b6e7 --- /dev/null +++ b/descqa/configs/ApparentMagFunc.yaml @@ -0,0 +1 @@ +subclass_name: basic_test.ApparentMagFuncTest \ No newline at end of file From 62e77bc99f9753428e63dd0505f7161be70386a1 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 7 Dec 2017 14:47:58 -0600 Subject: [PATCH 12/74] added hsc app mag func test data --- descqa/data/apparent_mag_func/hsc_g_n.dat | 181 ++++++++++++++++++++++ descqa/data/apparent_mag_func/hsc_i_n.dat | 181 ++++++++++++++++++++++ descqa/data/apparent_mag_func/hsc_r_n.dat | 181 ++++++++++++++++++++++ descqa/data/apparent_mag_func/hsc_y_n.dat | 181 ++++++++++++++++++++++ descqa/data/apparent_mag_func/hsc_z_n.dat | 181 ++++++++++++++++++++++ 5 files changed, 905 insertions(+) create mode 100644 descqa/data/apparent_mag_func/hsc_g_n.dat create mode 100644 descqa/data/apparent_mag_func/hsc_i_n.dat create mode 100644 descqa/data/apparent_mag_func/hsc_r_n.dat create mode 100644 descqa/data/apparent_mag_func/hsc_y_n.dat create mode 100644 descqa/data/apparent_mag_func/hsc_z_n.dat diff --git a/descqa/data/apparent_mag_func/hsc_g_n.dat b/descqa/data/apparent_mag_func/hsc_g_n.dat new file mode 100644 index 00000000..897af315 --- /dev/null +++ b/descqa/data/apparent_mag_func/hsc_g_n.dat @@ -0,0 +1,181 @@ +mag n( Date: Thu, 7 Dec 2017 14:51:47 -0600 Subject: [PATCH 13/74] reorganized data files --- descqa/data/apparent_mag_func/HSC/hsc_g_n.dat | 181 ++++++++++++++++++ descqa/data/apparent_mag_func/HSC/hsc_i_n.dat | 181 ++++++++++++++++++ descqa/data/apparent_mag_func/HSC/hsc_r_n.dat | 181 ++++++++++++++++++ descqa/data/apparent_mag_func/HSC/hsc_y_n.dat | 181 ++++++++++++++++++ descqa/data/apparent_mag_func/HSC/hsc_z_n.dat | 181 ++++++++++++++++++ descqa/data/apparent_mag_func/README.md | 12 ++ 6 files changed, 917 insertions(+) create mode 100644 descqa/data/apparent_mag_func/HSC/hsc_g_n.dat create mode 100644 descqa/data/apparent_mag_func/HSC/hsc_i_n.dat create mode 100644 descqa/data/apparent_mag_func/HSC/hsc_r_n.dat create mode 100644 descqa/data/apparent_mag_func/HSC/hsc_y_n.dat create mode 100644 descqa/data/apparent_mag_func/HSC/hsc_z_n.dat create mode 100644 descqa/data/apparent_mag_func/README.md diff --git a/descqa/data/apparent_mag_func/HSC/hsc_g_n.dat b/descqa/data/apparent_mag_func/HSC/hsc_g_n.dat new file mode 100644 index 00000000..897af315 --- /dev/null +++ b/descqa/data/apparent_mag_func/HSC/hsc_g_n.dat @@ -0,0 +1,181 @@ +mag n( Date: Thu, 7 Dec 2017 15:05:46 -0600 Subject: [PATCH 14/74] added observation data to test --- descqa/apparent_mag_func_test.py | 38 ++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 3fdd4d82..0d15655f 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -5,13 +5,23 @@ from .plotting import plt +possible_observations = { + 'HSC': { + 'filename_template': 'apparent_mag_func/HSC/hsc_{}_n.dat', + 'usecols': (0, 1, 2), + 'colnames': ('mag', 'n', 'err'), + 'skiprows': 0, + 'label': 'HSC (D. Campbell, Sprint Week-Dec 2017)', + } +} + __all__ = ['ApparentMagFuncTest'] class ApparentMagFuncTest(BaseValidationTest): """ apparent magnitude function test """ - def __init__(self, band='i', band_lim=27, observation=None, **kwargs): + def __init__(self, band='i', band_lim=27, observation='', **kwargs): """ parameters ---------- @@ -19,7 +29,11 @@ def __init__(self, band='i', band_lim=27, observation=None, **kwargs): photometric band band_lim : float - apparent magnitude upper magnitude limit + apparent magnitude upper limit + + observation : string + string indicating which obsrvational data to use for validating + """ #catalog quantities @@ -41,6 +55,26 @@ def __init__(self, band='i', band_lim=27, observation=None, **kwargs): # prepare summary plot self.summary_fig, self.summary_ax = plt.subplots() + + def get_validation_data(self, band, observation): + """ + load (observational) data to use for validation test + """ + data_args = possible_observations[observation] + data_path = os.path.join(self.data_dir, data_args['filename_template'].format(band)) + + if not os.path.exists(data_path): + raise ValueError("{}-band data file {} not found".format(band, data_path)) + + if not os.path.getsize(data_path): + raise ValueError("{}-band data file {} is empty".format(band, data_path)) + + data = np.loadtxt(data_path, unpack=True, usecols=data_args['usecols'], skiprows=data_args['skiprows']) + + validation_data = dict(zip(data_args['colnames'], data)) + validation_data['label'] = data_args['label'] + + return validation_data def post_process_plot(self, ax): From 6c224933fa4e165db292daccf9572c69c44848da Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 7 Dec 2017 15:15:55 -0600 Subject: [PATCH 15/74] fixed bugs --- descqa/apparent_mag_func_test.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 0d15655f..0eac85fd 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -9,7 +9,7 @@ 'HSC': { 'filename_template': 'apparent_mag_func/HSC/hsc_{}_n.dat', 'usecols': (0, 1, 2), - 'colnames': ('mag', 'n', 'err'), + 'colnames': ('mag', 'n( Date: Thu, 7 Dec 2017 15:18:54 -0600 Subject: [PATCH 16/74] fixed bugs --- descqa/apparent_mag_func_test.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 0eac85fd..6affab9e 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -81,6 +81,18 @@ def get_validation_data(self, band, observation): def post_process_plot(self, ax): pass + + @staticmethod + def get_catalog_data(gc, quantities, filters=None): + data = {} + if not gc.has_quantities(quantities): + return TestResult(skipped=True, summary='Missing requested quantities') + + data = gc.get_quantities(quantities, filters=filters) + #make sure data entries are all finite + data = GCRQuery(*((np.isfinite, col) for col in data)).filter(data) + + return data def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): @@ -89,7 +101,7 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): return TestResult(skipped=True, summary='Missing requested quantities') #retreive data - d = gc.get_quantities([mag_field_key]) + d = catalog_instance.get_quantities([mag_field_key]) m = d[mag_field_key] m = np.sort(m) #put into order--bright to faint From 1a946f6a73655a11e5e18ed4a7cb8ae0e703c5cc Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 7 Dec 2017 15:19:50 -0600 Subject: [PATCH 17/74] fixed bugs --- descqa/apparent_mag_func_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 6affab9e..dcae5f81 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -112,7 +112,7 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): #define magnitude bins for plotting purposes self.dmag = 0.1 - self.max_mag = mag_lim + 1.0 + self.max_mag = self.band_lim + 1.0 self.min_mag = 17.7 mag_bins = np.arange(self.min_mag ,self.max_mag, self.dmag) From 24a9a4d9582977e3d6b6f32158b60de771bf5372 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 7 Dec 2017 15:22:10 -0600 Subject: [PATCH 18/74] fixed bugs --- descqa/apparent_mag_func_test.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index dcae5f81..1fffb449 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -118,6 +118,8 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): #calculate N at the specified points inds = np.searchsorted(m,mag_bins) + mask = (inds >= len(m)) + inds[mask] = -1 sampled_N = N[inds] fig, ax = plt.subplots() From d7823c7a25cb89d3b6e54793303ea09fbe0da7bb Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 7 Dec 2017 15:26:34 -0600 Subject: [PATCH 19/74] fixed bugs --- descqa/apparent_mag_func_test.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 1fffb449..c9fe9b65 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -21,7 +21,7 @@ class ApparentMagFuncTest(BaseValidationTest): """ apparent magnitude function test """ - def __init__(self, band='i', band_lim=27, observation='', **kwargs): + def __init__(self, band='i', band_lim=27.5, observation='', **kwargs): """ parameters ---------- @@ -106,8 +106,9 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): m = np.sort(m) #put into order--bright to faint #caclulate cumulative number of galaxies less than band_lim - mask = (m < self.band_lim) - N_tot = np.sum(mask) + #mask = (m < self.band_lim) + #N_tot = np.sum(mask) + N_tot = len(m) N = np.cumsum(np.ones(N_tot)) #define magnitude bins for plotting purposes From ec424a540dc41fc625f4bc7302fe36607e41cef7 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 7 Dec 2017 15:27:27 -0600 Subject: [PATCH 20/74] fixed bugs --- descqa/apparent_mag_func_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index c9fe9b65..d92e572e 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -128,7 +128,7 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): for ax_this in (ax, self.summary_ax): ax_this.plot(mag_bins, sampled_N, 'o', label=catalog_name) ax_this.plot(self.band_lim, N_tot) - ax_this.yscale('log') + ax_this.set_yscale('log') self.post_process_plot(ax) fig.savefig(os.path.join(output_dir, 'cumulative_app_mag_plot.png')) From a3a619b42f2ef01c16500765fceeeac045df48c4 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 7 Dec 2017 15:36:44 -0600 Subject: [PATCH 21/74] fixed bugs --- descqa/apparent_mag_func_test.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index d92e572e..07af0bcf 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -109,7 +109,7 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): #mask = (m < self.band_lim) #N_tot = np.sum(mask) N_tot = len(m) - N = np.cumsum(np.ones(N_tot)) + N = np.cumsum(np.ones(N_tot))/catalog_instance.sky_area #define magnitude bins for plotting purposes self.dmag = 0.1 @@ -126,9 +126,11 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): fig, ax = plt.subplots() for ax_this in (ax, self.summary_ax): - ax_this.plot(mag_bins, sampled_N, 'o', label=catalog_name) + ax_this.plot(mag_bins, sampled_N, '-', label=catalog_name) ax_this.plot(self.band_lim, N_tot) ax_this.set_yscale('log') + ax.set_ylabel(r'$mag$') + ax.set_ylabel(r'$N(<{\rm mag}){\rm deg}^{-2}$') self.post_process_plot(ax) fig.savefig(os.path.join(output_dir, 'cumulative_app_mag_plot.png')) From 1ffb05dd8e82ede2b79388f3d99da4b629507d2a Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 7 Dec 2017 15:44:39 -0600 Subject: [PATCH 22/74] added aky area atribute check --- descqa/apparent_mag_func_test.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 07af0bcf..ccbe8c22 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -106,8 +106,12 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): m = np.sort(m) #put into order--bright to faint #caclulate cumulative number of galaxies less than band_lim - #mask = (m < self.band_lim) - #N_tot = np.sum(mask) + try: + sky_area = catalog_instance.sky_area + except AttributeError: + print('Warning: this catalog has no sky_area attribute! Setting sky_area=25 sq deg.') + sky_area = 25.0 + N_tot = len(m) N = np.cumsum(np.ones(N_tot))/catalog_instance.sky_area From 62f63354724c24f0211a52a8451271d0d19d6e5c Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 7 Dec 2017 15:45:13 -0600 Subject: [PATCH 23/74] added aky area atribute check --- descqa/apparent_mag_func_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index ccbe8c22..535b8aad 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -113,7 +113,7 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): sky_area = 25.0 N_tot = len(m) - N = np.cumsum(np.ones(N_tot))/catalog_instance.sky_area + N = np.cumsum(np.ones(N_tot))/sky_area #define magnitude bins for plotting purposes self.dmag = 0.1 From 445ec0f88b13355e6c70799059c25f3930e37ee3 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 7 Dec 2017 15:50:45 -0600 Subject: [PATCH 24/74] plotting validation data --- descqa/apparent_mag_func_test.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 535b8aad..9fa1345c 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -133,8 +133,14 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): ax_this.plot(mag_bins, sampled_N, '-', label=catalog_name) ax_this.plot(self.band_lim, N_tot) ax_this.set_yscale('log') - ax.set_ylabel(r'$mag$') - ax.set_ylabel(r'$N(<{\rm mag}){\rm deg}^{-2}$') + ax_this.set_ylabel(r'$\rm mag$') + ax_this.set_ylabel(r'$N(<{\rm mag}){\rm deg}^{-2}$') + + #plot validation data + for ax_this in (ax, self.summary_ax): + n = self.validation_data['n'] + m = self.validation_data['mag'] + ax_this.plot(mag_bins, sampled_N, 'o', label=self.validation_data['label']) self.post_process_plot(ax) fig.savefig(os.path.join(output_dir, 'cumulative_app_mag_plot.png')) From be711637c364b5dcae9480a203d3c01922ff2165 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 7 Dec 2017 15:51:16 -0600 Subject: [PATCH 25/74] plotting validation data --- descqa/apparent_mag_func_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 9fa1345c..112b4e22 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -138,7 +138,7 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): #plot validation data for ax_this in (ax, self.summary_ax): - n = self.validation_data['n'] + n = self.validation_data['n( Date: Thu, 7 Dec 2017 15:52:52 -0600 Subject: [PATCH 26/74] plotting validation data --- descqa/apparent_mag_func_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 112b4e22..ef2dba95 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -21,7 +21,7 @@ class ApparentMagFuncTest(BaseValidationTest): """ apparent magnitude function test """ - def __init__(self, band='i', band_lim=27.5, observation='', **kwargs): + def __init__(self, band='i', band_lim=27.5, observation='HSC', **kwargs): """ parameters ---------- From dbde33c1aea1e2b151341e9764917bb8ddff7a66 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 7 Dec 2017 15:53:58 -0600 Subject: [PATCH 27/74] plotting validation data --- descqa/apparent_mag_func_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index ef2dba95..c55ff641 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -10,7 +10,7 @@ 'filename_template': 'apparent_mag_func/HSC/hsc_{}_n.dat', 'usecols': (0, 1, 2), 'colnames': ('mag', 'n( Date: Thu, 7 Dec 2017 16:00:25 -0600 Subject: [PATCH 28/74] fixed plottin bug --- descqa/apparent_mag_func_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index c55ff641..0f924f3f 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -140,7 +140,7 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): for ax_this in (ax, self.summary_ax): n = self.validation_data['n( Date: Thu, 7 Dec 2017 16:01:10 -0600 Subject: [PATCH 29/74] fixed plottin bug --- descqa/apparent_mag_func_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 0f924f3f..07960c92 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -140,7 +140,7 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): for ax_this in (ax, self.summary_ax): n = self.validation_data['n( Date: Thu, 7 Dec 2017 16:03:15 -0600 Subject: [PATCH 30/74] fixed plottin bug --- descqa/apparent_mag_func_test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 07960c92..808653dd 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -134,7 +134,9 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): ax_this.plot(self.band_lim, N_tot) ax_this.set_yscale('log') ax_this.set_ylabel(r'$\rm mag$') - ax_this.set_ylabel(r'$N(<{\rm mag}){\rm deg}^{-2}$') + ax_this.set_ylabel(r'$N(<{\rm mag})~[{\rm deg}^{-2}]$') + ax_this.set_xlim([17,30]) + ax_this.set_ylim([1,8]) #plot validation data for ax_this in (ax, self.summary_ax): From 43ddc197c2f1ea1806d8a1fefaf1b9831b80525b Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 7 Dec 2017 16:05:51 -0600 Subject: [PATCH 31/74] fixed plottin bug --- descqa/apparent_mag_func_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 808653dd..d9e82174 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -136,7 +136,7 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): ax_this.set_ylabel(r'$\rm mag$') ax_this.set_ylabel(r'$N(<{\rm mag})~[{\rm deg}^{-2}]$') ax_this.set_xlim([17,30]) - ax_this.set_ylim([1,8]) + ax_this.set_ylim([1,10**8]) #plot validation data for ax_this in (ax, self.summary_ax): From 71cda7199aaac767fcfa823221a50483f2a3b8ed Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Fri, 8 Dec 2017 17:20:33 -0600 Subject: [PATCH 32/74] fixed up the plots --- descqa/apparent_mag_func_test.py | 47 +++++++++++++------- descqagen/app_mag_func_test/data/__init__.py | 0 2 files changed, 31 insertions(+), 16 deletions(-) create mode 100644 descqagen/app_mag_func_test/data/__init__.py diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index d9e82174..d16b57d5 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -36,21 +36,23 @@ def __init__(self, band='i', band_lim=27.5, observation='HSC', **kwargs): """ - #catalog quantities + #catalog quantities needed possible_mag_fields = ('mag_{}_lsst', 'mag_{}_sdss', 'mag_{}_des', 'mag_{}_hsc', ) self.possible_mag_fields = [f.format(band) for f in possible_mag_fields] + + #attach some attributes to the test self.band = band self.band_lim = band_lim - #check for validation observations + #check for validation observation if not observation: - print('Warning: no data file supplied, no observation requested; only catalog data will be shown') + print('Warning: no data file supplied, no observation requested; only catalog data will be shown.') elif observation not in possible_observations: - raise ValueError('Observation {} not available'.format(observation)) + raise ValueError('Observation: {} not available for this test.'.format(observation)) else: self.validation_data = self.get_validation_data(band, observation) @@ -79,7 +81,10 @@ def get_validation_data(self, band, observation): def post_process_plot(self, ax): - pass + + ax.legend(loc='upper left') + ax.set_ylabel('n(< {\rm mag}) ~[{\rm deg^{-2}}]') + ax.set_xlabel(self.band + ' magnitude') @staticmethod @@ -95,30 +100,33 @@ def get_catalog_data(gc, quantities, filters=None): return data def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): - + mag_field_key = catalog_instance.first_available(*self.possible_mag_fields) if not mag_field_key: - return TestResult(skipped=True, summary='Missing requested quantities') + return TestResult(skipped=True, summary='Catalog is missing requested quantity: {}'.format(self.possible_mag_fields)) - #retreive data + #retreive data from mock catalog d = catalog_instance.get_quantities([mag_field_key]) m = d[mag_field_key] m = np.sort(m) #put into order--bright to faint #caclulate cumulative number of galaxies less than band_lim + if not catalog_instance.lightcone: + return TestResult(skipped=True, summary="Catalog is not a light cone.") + try: sky_area = catalog_instance.sky_area except AttributeError: - print('Warning: this catalog has no sky_area attribute! Setting sky_area=25 sq deg.') - sky_area = 25.0 + return TestResult(skipped=True, summary="Catalog needs an attribute 'sky_area'.") + #get total number of galaxies N_tot = len(m) N = np.cumsum(np.ones(N_tot))/sky_area - #define magnitude bins for plotting purposes + #define apparent magnitude bins for plotting purposes self.dmag = 0.1 - self.max_mag = self.band_lim + 1.0 - self.min_mag = 17.7 + self.max_mag = self.band_lim + 1.0 #go one mag beyond the limit + self.min_mag = 17.7 #start at bright galaxies mag_bins = np.arange(self.min_mag ,self.max_mag, self.dmag) #calculate N at the specified points @@ -126,10 +134,11 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): mask = (inds >= len(m)) inds[mask] = -1 sampled_N = N[inds] - + + #plot cumulative apparent magnitude function fig, ax = plt.subplots() - for ax_this in (ax, self.summary_ax): + for ax_this in (ax, self.summary_ax): #plot on both this and summary plots ax_this.plot(mag_bins, sampled_N, '-', label=catalog_name) ax_this.plot(self.band_lim, N_tot) ax_this.set_yscale('log') @@ -139,7 +148,7 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): ax_this.set_ylim([1,10**8]) #plot validation data - for ax_this in (ax, self.summary_ax): + for ax_this in ax: n = self.validation_data['n( Date: Thu, 8 Feb 2018 16:30:54 -0800 Subject: [PATCH 33/74] updated hsc data --- descqa/data/apparent_mag_func/HSC/hsc_g_n.dat | 360 +++++++++--------- descqa/data/apparent_mag_func/HSC/hsc_i_n.dat | 360 +++++++++--------- descqa/data/apparent_mag_func/HSC/hsc_r_n.dat | 360 +++++++++--------- descqa/data/apparent_mag_func/HSC/hsc_y_n.dat | 360 +++++++++--------- descqa/data/apparent_mag_func/HSC/hsc_z_n.dat | 360 +++++++++--------- descqa/data/apparent_mag_func/hsc_g_n.dat | 181 --------- descqa/data/apparent_mag_func/hsc_i_n.dat | 181 --------- descqa/data/apparent_mag_func/hsc_r_n.dat | 181 --------- descqa/data/apparent_mag_func/hsc_y_n.dat | 181 --------- descqa/data/apparent_mag_func/hsc_z_n.dat | 181 --------- 10 files changed, 900 insertions(+), 1805 deletions(-) delete mode 100644 descqa/data/apparent_mag_func/hsc_g_n.dat delete mode 100644 descqa/data/apparent_mag_func/hsc_i_n.dat delete mode 100644 descqa/data/apparent_mag_func/hsc_r_n.dat delete mode 100644 descqa/data/apparent_mag_func/hsc_y_n.dat delete mode 100644 descqa/data/apparent_mag_func/hsc_z_n.dat diff --git a/descqa/data/apparent_mag_func/HSC/hsc_g_n.dat b/descqa/data/apparent_mag_func/HSC/hsc_g_n.dat index 897af315..28fa7452 100644 --- a/descqa/data/apparent_mag_func/HSC/hsc_g_n.dat +++ b/descqa/data/apparent_mag_func/HSC/hsc_g_n.dat @@ -1,181 +1,181 @@ mag n( Date: Thu, 12 Apr 2018 13:41:23 -0400 Subject: [PATCH 34/74] updated hsc data --- descqa/data/apparent_mag_func/HSC/hsc_g_n.dat | 36 ++++++++--------- descqa/data/apparent_mag_func/HSC/hsc_i_n.dat | 40 +++++++++---------- descqa/data/apparent_mag_func/HSC/hsc_r_n.dat | 36 ++++++++--------- descqa/data/apparent_mag_func/HSC/hsc_y_n.dat | 32 +++++++-------- descqa/data/apparent_mag_func/HSC/hsc_z_n.dat | 32 +++++++-------- 5 files changed, 88 insertions(+), 88 deletions(-) diff --git a/descqa/data/apparent_mag_func/HSC/hsc_g_n.dat b/descqa/data/apparent_mag_func/HSC/hsc_g_n.dat index 28fa7452..3bd41083 100644 --- a/descqa/data/apparent_mag_func/HSC/hsc_g_n.dat +++ b/descqa/data/apparent_mag_func/HSC/hsc_g_n.dat @@ -35,15 +35,15 @@ mag n( Date: Thu, 12 Apr 2018 15:17:27 -0400 Subject: [PATCH 35/74] small changes --- descqa/apparent_mag_func_test.py | 67 +++++++++++++++----------------- 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index d16b57d5..3614e01e 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -11,12 +11,13 @@ 'usecols': (0, 1, 2), 'colnames': ('mag', 'n(= len(m)) inds[mask] = -1 sampled_N = N[inds] - - #plot cumulative apparent magnitude function + + # plot cumulative apparent magnitude function fig, ax = plt.subplots() - for ax_this in (ax, self.summary_ax): #plot on both this and summary plots + for ax_this in (ax, self.summary_ax): # plot on both this and summary plots ax_this.plot(mag_bins, sampled_N, '-', label=catalog_name) ax_this.plot(self.band_lim, N_tot) ax_this.set_yscale('log') @@ -147,7 +145,7 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): ax_this.set_xlim([17,30]) ax_this.set_ylim([1,10**8]) - #plot validation data + # plot validation data for ax_this in ax: n = self.validation_data['n( Date: Thu, 12 Apr 2018 15:28:03 -0400 Subject: [PATCH 36/74] small changes --- descqa/apparent_mag_func_test.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 3614e01e..3e7bbac3 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -145,8 +145,7 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): ax_this.set_xlim([17,30]) ax_this.set_ylim([1,10**8]) - # plot validation data - for ax_this in ax: + # plot validation data n = self.validation_data['n( Date: Thu, 12 Apr 2018 15:31:28 -0400 Subject: [PATCH 37/74] small changes --- descqa/apparent_mag_func_test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 3e7bbac3..a0a978ad 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -145,7 +145,8 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): ax_this.set_xlim([17,30]) ax_this.set_ylim([1,10**8]) - # plot validation data + # plot validation data + for ax_this in [ax]: n = self.validation_data['n( Date: Thu, 12 Apr 2018 16:23:18 -0400 Subject: [PATCH 38/74] small changes --- descqa/apparent_mag_func_test.py | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index a0a978ad..e1569154 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -1,6 +1,7 @@ from __future__ import unicode_literals, absolute_import, division import os import numpy as np +from scipy.interpolate import interp1d from .base import BaseValidationTest, TestResult from .plotting import plt @@ -22,7 +23,7 @@ class ApparentMagFuncTest(BaseValidationTest): """ apparent magnitude function test """ - def __init__(self, band='i', band_lim=27.5, observation='HSC', **kwargs): + def __init__(self, band='i', band_lim=[24, 27.5], rtol=0.2, observation='HSC', **kwargs): """ parameters ---------- @@ -30,7 +31,10 @@ def __init__(self, band='i', band_lim=27.5, observation='HSC', **kwargs): photometric band band_lim : float - apparent magnitude upper limit + apparent magnitude lower and upper limits + + rtol : float + relative tolerance alowed between mock and test data observation : string string indicating which obsrvational data to use for validating @@ -47,6 +51,7 @@ def __init__(self, band='i', band_lim=27.5, observation='HSC', **kwargs): # attach some attributes to the test self.band = band self.band_lim = band_lim + self.rtol = rtol # check for validation observation if not observation: @@ -149,14 +154,26 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): for ax_this in [ax]: n = self.validation_data['n(= y_min(m_sample))) + + score = (y(m_sample) - y0(m_sample))/y0(m_sample) + + return TestResult(score, passed=passed) def conclude_test(self, output_dir): From 43c007ed89fba82326c43afdc967b9e98a8b148a Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 12 Apr 2018 16:26:04 -0400 Subject: [PATCH 39/74] small changes --- descqa/apparent_mag_func_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index e1569154..2df3f9c3 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -128,8 +128,8 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): # define apparent magnitude bins for plotting purposes self.dmag = 0.1 - self.max_mag = self.band_lim + 1.0 # go one mag beyond the limit - self.min_mag = 17.7 # start at bright galaxies + self.max_mag = self.band_lim[1] + 1.0 # go one mag beyond the limit + self.min_mag = self.band_lim[0] - 1.0 # start at bright galaxies mag_bins = np.arange(self.min_mag, self.max_mag, self.dmag) # calculate N at the specified points From c52306a34fdaaa4e658a22b9d123b22177eed551 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 12 Apr 2018 16:27:46 -0400 Subject: [PATCH 40/74] small changes --- descqa/apparent_mag_func_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 2df3f9c3..85575645 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -143,7 +143,7 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): for ax_this in (ax, self.summary_ax): # plot on both this and summary plots ax_this.plot(mag_bins, sampled_N, '-', label=catalog_name) - ax_this.plot(self.band_lim, N_tot) + #ax_this.plot(self.band_lim, N_tot) ax_this.set_yscale('log') ax_this.set_ylabel(r'$\rm mag$') ax_this.set_ylabel(r'$N(<{\rm mag})~[{\rm deg}^{-2}]$') From 20a38f2e2d25c6bd54e16104e269c1f1144300a8 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 12 Apr 2018 16:28:58 -0400 Subject: [PATCH 41/74] small changes --- descqa/apparent_mag_func_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 85575645..17a945fc 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -155,7 +155,7 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): n = self.validation_data['n( Date: Thu, 12 Apr 2018 16:34:58 -0400 Subject: [PATCH 42/74] small changes --- descqa/apparent_mag_func_test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 17a945fc..3471ee01 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -180,7 +180,8 @@ def conclude_test(self, output_dir): # plot verifaction data on summary plot n = self.validation_data['n( Date: Thu, 12 Apr 2018 16:39:00 -0400 Subject: [PATCH 43/74] small changes --- descqa/apparent_mag_func_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 3471ee01..468034d2 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -87,7 +87,7 @@ def get_validation_data(self, band, observation): def post_process_plot(self, ax): ax.legend(loc='upper left') - ax.set_ylabel('n(< {\rm mag}) ~[{\rm deg^{-2}}]') + ax.set_ylabel(r'$n(< {\rm mag}) ~[{\rm deg^{-2}}]$') ax.set_xlabel(self.band + ' magnitude') @staticmethod @@ -171,7 +171,7 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): m_sample = np.linspace(self.band_lim[0], self.band_lim[0], 10000) passed = (np.any(y(m_sample) <= y_max(m_sample))) & (np.any(y(m_sample) >= y_min(m_sample))) - score = (y(m_sample) - y0(m_sample))/y0(m_sample) + score = np.max(np.fabs((y(m_sample) - y0(m_sample))/y0(m_sample))) return TestResult(score, passed=passed) From f1ba18a284f89a090da4097d533bfc3097a11943 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 12 Apr 2018 16:41:49 -0400 Subject: [PATCH 44/74] small changes --- descqa/apparent_mag_func_test.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 468034d2..5711a678 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -12,7 +12,7 @@ 'usecols': (0, 1, 2), 'colnames': ('mag', 'n(= y_min(m_sample))) + passed = (np.all(y(m_sample) <= y_max(m_sample))) & (np.all(y(m_sample) >= y_min(m_sample))) score = np.max(np.fabs((y(m_sample) - y0(m_sample))/y0(m_sample))) From 5a4509e309d1c9c2668090a2b1ae2c15a3b1b47b Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 12 Apr 2018 16:46:27 -0400 Subject: [PATCH 45/74] small changes --- descqa/apparent_mag_func_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 5711a678..287f100c 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -12,7 +12,7 @@ 'usecols': (0, 1, 2), 'colnames': ('mag', 'n(= y_min(m_sample))) From 845f6dd57f807aa6de92c767a37d0973dd89b384 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 12 Apr 2018 16:48:43 -0400 Subject: [PATCH 46/74] small changes --- descqa/apparent_mag_func_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 287f100c..ef4ad28d 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -90,6 +90,7 @@ def post_process_plot(self, ax): ax.set_ylabel(r'$n(< {\rm mag}) ~[{\rm deg^{-2}}]$') ax.set_xlabel(self.band + ' magnitude') ax.set_ylim([1000,10**7]) + ax.set_title(str(self.band_lim[0]) + ' < '+self.band + ' < ' + str(self.band_lim[1])) @staticmethod def get_catalog_data(gc, quantities, filters=None): From a77760c79bd7ea01783e890b2e7d8126c73a6c43 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 12 Apr 2018 17:01:40 -0400 Subject: [PATCH 47/74] small changes --- descqa/apparent_mag_func_test.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index ef4ad28d..7918c2b2 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -45,7 +45,11 @@ def __init__(self, band='i', band_lim=[24, 27.5], rtol=0.2, observation='HSC', * possible_mag_fields = ('mag_{}_lsst', 'mag_{}_sdss', 'mag_{}_des', - 'mag_{}_hsc') + 'mag_{}_hsc', + 'mag_true_{}_lsst', + 'mag_true_{}_sdss', + 'mag_true_{}_des', + 'mag_true_{}_hsc') self.possible_mag_fields = [f.format(band) for f in possible_mag_fields] # attach some attributes to the test @@ -90,6 +94,7 @@ def post_process_plot(self, ax): ax.set_ylabel(r'$n(< {\rm mag}) ~[{\rm deg^{-2}}]$') ax.set_xlabel(self.band + ' magnitude') ax.set_ylim([1000,10**7]) + ax.set_yscale('log') ax.set_title(str(self.band_lim[0]) + ' < '+self.band + ' < ' + str(self.band_lim[1])) @staticmethod From db1ef6c0095691f8bf56df078fa17c077417aa99 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 12 Apr 2018 17:08:47 -0400 Subject: [PATCH 48/74] added tests for each band --- descqa/configs/ApparentMagFunc.yaml | 1 - descqa/configs/ApparentMagFuncTest.yaml | 1 - descqa/configs/ApparentMagFuncTest_HSCg.yaml | 6 ++++++ descqa/configs/ApparentMagFuncTest_HSCi.yaml | 6 ++++++ descqa/configs/ApparentMagFuncTest_HSCr.yaml | 6 ++++++ descqa/configs/ApparentMagFuncTest_HSCy.yaml | 6 ++++++ descqa/configs/ApparentMagFuncTest_HSCz.yaml | 6 ++++++ 7 files changed, 30 insertions(+), 2 deletions(-) delete mode 100644 descqa/configs/ApparentMagFunc.yaml delete mode 100644 descqa/configs/ApparentMagFuncTest.yaml create mode 100644 descqa/configs/ApparentMagFuncTest_HSCg.yaml create mode 100644 descqa/configs/ApparentMagFuncTest_HSCi.yaml create mode 100644 descqa/configs/ApparentMagFuncTest_HSCr.yaml create mode 100644 descqa/configs/ApparentMagFuncTest_HSCy.yaml create mode 100644 descqa/configs/ApparentMagFuncTest_HSCz.yaml diff --git a/descqa/configs/ApparentMagFunc.yaml b/descqa/configs/ApparentMagFunc.yaml deleted file mode 100644 index 2c58b6e7..00000000 --- a/descqa/configs/ApparentMagFunc.yaml +++ /dev/null @@ -1 +0,0 @@ -subclass_name: basic_test.ApparentMagFuncTest \ No newline at end of file diff --git a/descqa/configs/ApparentMagFuncTest.yaml b/descqa/configs/ApparentMagFuncTest.yaml deleted file mode 100644 index 57472ea7..00000000 --- a/descqa/configs/ApparentMagFuncTest.yaml +++ /dev/null @@ -1 +0,0 @@ -subclass_name: apparent_mag_func_test.ApparentMagFuncTest \ No newline at end of file diff --git a/descqa/configs/ApparentMagFuncTest_HSCg.yaml b/descqa/configs/ApparentMagFuncTest_HSCg.yaml new file mode 100644 index 00000000..56f487aa --- /dev/null +++ b/descqa/configs/ApparentMagFuncTest_HSCg.yaml @@ -0,0 +1,6 @@ +subclass_name: apparent_mag_func_test.ApparentMagFuncTest +band: g +band_lim: [24, 27.5] +observation: 'HSC' +included_by_default: true +description: 'Plot N( Date: Thu, 12 Apr 2018 17:12:40 -0400 Subject: [PATCH 49/74] fixed bug --- descqa/configs/ApparentMagFuncTest_HSCi.yaml | 2 +- descqa/configs/ApparentMagFuncTest_HSCr.yaml | 2 +- descqa/configs/ApparentMagFuncTest_HSCz.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/descqa/configs/ApparentMagFuncTest_HSCi.yaml b/descqa/configs/ApparentMagFuncTest_HSCi.yaml index 56f487aa..dc9b6a52 100644 --- a/descqa/configs/ApparentMagFuncTest_HSCi.yaml +++ b/descqa/configs/ApparentMagFuncTest_HSCi.yaml @@ -1,5 +1,5 @@ subclass_name: apparent_mag_func_test.ApparentMagFuncTest -band: g +band: i band_lim: [24, 27.5] observation: 'HSC' included_by_default: true diff --git a/descqa/configs/ApparentMagFuncTest_HSCr.yaml b/descqa/configs/ApparentMagFuncTest_HSCr.yaml index 1f947d7f..ac31bcbe 100644 --- a/descqa/configs/ApparentMagFuncTest_HSCr.yaml +++ b/descqa/configs/ApparentMagFuncTest_HSCr.yaml @@ -1,5 +1,5 @@ subclass_name: apparent_mag_func_test.ApparentMagFuncTest -band: z +band: r band_lim: [24, 27.5] observation: 'HSC' included_by_default: true diff --git a/descqa/configs/ApparentMagFuncTest_HSCz.yaml b/descqa/configs/ApparentMagFuncTest_HSCz.yaml index aa4aca05..1f947d7f 100644 --- a/descqa/configs/ApparentMagFuncTest_HSCz.yaml +++ b/descqa/configs/ApparentMagFuncTest_HSCz.yaml @@ -1,5 +1,5 @@ subclass_name: apparent_mag_func_test.ApparentMagFuncTest -band: y +band: z band_lim: [24, 27.5] observation: 'HSC' included_by_default: true From b38abcba06a7913b412a95570698bf44fce66f27 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 12 Apr 2018 17:24:24 -0400 Subject: [PATCH 50/74] big fix --- descqa/apparent_mag_func_test.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 7918c2b2..bcc46560 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -43,12 +43,12 @@ def __init__(self, band='i', band_lim=[24, 27.5], rtol=0.2, observation='HSC', * # catalog quantities needed possible_mag_fields = ('mag_{}_lsst', - 'mag_{}_sdss', - 'mag_{}_des', - 'mag_{}_hsc', 'mag_true_{}_lsst', + 'mag_{}_sdss', 'mag_true_{}_sdss', + 'mag_{}_des', 'mag_true_{}_des', + 'mag_{}_hsc', 'mag_true_{}_hsc') self.possible_mag_fields = [f.format(band) for f in possible_mag_fields] @@ -93,7 +93,8 @@ def post_process_plot(self, ax): ax.legend(loc='upper left') ax.set_ylabel(r'$n(< {\rm mag}) ~[{\rm deg^{-2}}]$') ax.set_xlabel(self.band + ' magnitude') - ax.set_ylim([1000,10**7]) + ax.set_ylim([1000, 10**7]) + ax.fill_between([self.band_lim[0], self.band_lim[1]], [0, 0], [10**9, 10**9], alpha=0.1, color='grey') ax.set_yscale('log') ax.set_title(str(self.band_lim[0]) + ' < '+self.band + ' < ' + str(self.band_lim[1])) @@ -175,10 +176,10 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): # interpolate mock data y = interp1d(mag_bins, np.log10(sampled_N)) - m_sample = np.linspace(self.band_lim[0], self.band_lim[0], 10000) + m_sample = np.linspace(self.band_lim[0], self.band_lim[1], 10000) passed = (np.all(y(m_sample) <= y_max(m_sample))) & (np.all(y(m_sample) >= y_min(m_sample))) - score = np.max(np.fabs((y(m_sample) - y0(m_sample))/y0(m_sample))) + score = np.max(np.fabs((y(m_sample) - y0(m_sample)))/y0(m_sample))/self.rtol return TestResult(score, passed=passed) From 9f8639764f5d8c16dc38928f7b3d220ee4722abd Mon Sep 17 00:00:00 2001 From: Yao-Yuan Mao Date: Wed, 23 May 2018 09:06:35 -0700 Subject: [PATCH 51/74] make linter happy --- descqa/apparent_mag_func_test.py | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index bcc46560..f3298c2f 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -23,7 +23,7 @@ class ApparentMagFuncTest(BaseValidationTest): """ apparent magnitude function test """ - def __init__(self, band='i', band_lim=[24, 27.5], rtol=0.2, observation='HSC', **kwargs): + def __init__(self, band='i', band_lim=(24, 27.5), rtol=0.2, observation='HSC', **kwargs): """ parameters ---------- @@ -40,6 +40,7 @@ def __init__(self, band='i', band_lim=[24, 27.5], rtol=0.2, observation='HSC', * string indicating which obsrvational data to use for validating """ + # pylint: disable=super-init-not-called # catalog quantities needed possible_mag_fields = ('mag_{}_lsst', @@ -54,7 +55,7 @@ def __init__(self, band='i', band_lim=[24, 27.5], rtol=0.2, observation='HSC', * # attach some attributes to the test self.band = band - self.band_lim = band_lim + self.band_lim = list(band_lim) self.rtol = rtol # check for validation observation @@ -98,18 +99,6 @@ def post_process_plot(self, ax): ax.set_yscale('log') ax.set_title(str(self.band_lim[0]) + ' < '+self.band + ' < ' + str(self.band_lim[1])) - @staticmethod - def get_catalog_data(gc, quantities, filters=None): - data = {} - if not gc.has_quantities(quantities): - return TestResult(skipped=True, summary='Missing requested quantities') - - data = gc.get_quantities(quantities, filters=filters) - # make sure data entries are all finite - data = GCRQuery(*((np.isfinite, col) for col in data)).filter(data) - - return data - def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): mag_field_key = catalog_instance.first_available(*self.possible_mag_fields) @@ -135,10 +124,10 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): N = np.cumsum(np.ones(N_tot))/sky_area # define apparent magnitude bins for plotting purposes - self.dmag = 0.1 - self.max_mag = self.band_lim[1] + 1.0 # go one mag beyond the limit - self.min_mag = self.band_lim[0] - 1.0 # start at bright galaxies - mag_bins = np.arange(self.min_mag, self.max_mag, self.dmag) + dmag = 0.1 + max_mag = self.band_lim[1] + 1.0 # go one mag beyond the limit + min_mag = self.band_lim[0] - 1.0 # start at bright galaxies + mag_bins = np.arange(min_mag, max_mag, dmag) # calculate N at the specified points inds = np.searchsorted(m, mag_bins) @@ -155,8 +144,8 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): ax_this.set_yscale('log') ax_this.set_ylabel(r'$\rm mag$') ax_this.set_ylabel(r'$N(<{\rm mag})~[{\rm deg}^{-2}]$') - ax_this.set_xlim([17,30]) - ax_this.set_ylim([1,10**8]) + ax_this.set_xlim([17, 30]) + ax_this.set_ylim([1, 10**8]) # plot validation data for ax_this in [ax]: From 461f62b8b768bc6a76599dffec12485a0fe3b295 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 24 May 2018 19:45:13 -0400 Subject: [PATCH 52/74] small changes --- descqa/apparent_mag_func_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index d16b57d5..2d82c134 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -11,7 +11,7 @@ 'usecols': (0, 1, 2), 'colnames': ('mag', 'n( Date: Thu, 31 May 2018 12:59:12 -0400 Subject: [PATCH 53/74] updating test --- descqa/apparent_mag_func_test.py | 126 ++++-- descqa/data/apparent_mag_func/HSC/hsc_g_n.dat | 362 +++++++++--------- descqa/data/apparent_mag_func/HSC/hsc_i_n.dat | 362 +++++++++--------- descqa/data/apparent_mag_func/HSC/hsc_r_n.dat | 362 +++++++++--------- descqa/data/apparent_mag_func/HSC/hsc_y_n.dat | 362 +++++++++--------- descqa/data/apparent_mag_func/HSC/hsc_z_n.dat | 362 +++++++++--------- 6 files changed, 997 insertions(+), 939 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 2d82c134..3bde98b3 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -3,13 +3,14 @@ import numpy as np from .base import BaseValidationTest, TestResult from .plotting import plt +from scipy.interpolate import interp1d possible_observations = { 'HSC': { 'filename_template': 'apparent_mag_func/HSC/hsc_{}_n.dat', 'usecols': (0, 1, 2), - 'colnames': ('mag', 'n(= len(m)) inds[mask] = -1 sampled_N = N[inds] - #plot cumulative apparent magnitude function + ################################################# + # plot the cumulative apparent magnitude function + ################################################# + fig, ax = plt.subplots() - for ax_this in (ax, self.summary_ax): #plot on both this and summary plots + # plot on both this plot and any summary plots + for ax_this in (ax, self.summary_ax): + + # plot mock catalog data ax_this.plot(mag_bins, sampled_N, '-', label=catalog_name) ax_this.plot(self.band_lim, N_tot) + + # format plot ax_this.set_yscale('log') ax_this.set_ylabel(r'$\rm mag$') ax_this.set_ylabel(r'$N(<{\rm mag})~[{\rm deg}^{-2}]$') ax_this.set_xlim([17,30]) ax_this.set_ylim([1,10**8]) - #plot validation data + # plot validation data for ax_this in ax: n = self.validation_data['n(0.0) + x = self.validation_data['mag'][non_zero_mask] + y = np.log10(self.validation_data['n(= self.min_band_lim) & (mag_bins <= self.max_band_lim) + max_frac_diff = np.max(delta[test_range_mask]) + + # apply 'passing' criterion + if max_frac_diff>self.fractional_tol: + score = max_frac_diff + passed = False + else: + score = max_frac_diff + passed = True + + return TestResult(score, passed=passed) def conclude_test(self, output_dir): - - #plot verifaction data on summary plot + """ + """ + + # plot verification data on summary plot n = self.validation_data['n( Date: Fri, 1 Jun 2018 10:31:19 -0400 Subject: [PATCH 54/74] small change --- descqa/apparent_mag_func_test.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 8df91f9d..d90f7b0f 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -24,7 +24,7 @@ class ApparentMagFuncTest(BaseValidationTest): """ cumulative apparent magnitude function test """ - def __init__(self, band='r', band_lim=(24, 27.5), fractional_tol=0.4, observation='HSC', **kwargs): + def __init__(self, band='r', band_lim=(24.0, 27.5), fractional_tol=0.4, observation='HSC', **kwargs): """ parameters ---------- @@ -39,7 +39,6 @@ def __init__(self, band='r', band_lim=(24, 27.5), fractional_tol=0.4, observatio observation : string string indicating which obsrvational data to use for validating - """ # pylint: disable=super-init-not-called From 4dca8365f0ed49ca5534d71982e0c63dd0188c53 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Fri, 1 Jun 2018 10:36:28 -0400 Subject: [PATCH 55/74] small change --- descqa/apparent_mag_func_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index d90f7b0f..2366d842 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -140,7 +140,7 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): self.dmag = 0.1 # bin widths max_mag = self.band_lim[1] + 1.0 # go one mag beyond the limit min_mag = self.band_lim[0] - 1.0 # start at bright galaxies - mag_bins = np.arange(self.min_mag ,self.max_mag, self.dmag) + mag_bins = np.arange(self.band_lim[0] ,self.band_lim[1], self.dmag) # calculate N( Date: Fri, 1 Jun 2018 10:42:23 -0400 Subject: [PATCH 56/74] small change --- descqa/apparent_mag_func_test.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 2366d842..04adf691 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -58,6 +58,17 @@ def __init__(self, band='r', band_lim=(24.0, 27.5), fractional_tol=0.4, observat self.band_lim = list(band_lim) self.fractional_tol = fractional_tol + # check for validation observation + if not observation: + print('Warning: no data file supplied, no observation requested; only catalog data will be shown.') + elif observation not in possible_observations: + raise ValueError('Observation: {} not available for this test.'.format(observation)) + else: + self.validation_data = self.get_validation_data(band, observation) + + # prepare summary plot + self.summary_fig, self.summary_ax = plt.subplots() + def get_validation_data(self, band, observation): """ load (observational) data to use for validation test From 5a10df3a75dd3eae8abc541fae67d0e1b7597356 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Fri, 1 Jun 2018 10:43:23 -0400 Subject: [PATCH 57/74] small change --- descqa/apparent_mag_func_test.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 04adf691..7c3e513d 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -59,15 +59,15 @@ def __init__(self, band='r', band_lim=(24.0, 27.5), fractional_tol=0.4, observat self.fractional_tol = fractional_tol # check for validation observation - if not observation: - print('Warning: no data file supplied, no observation requested; only catalog data will be shown.') - elif observation not in possible_observations: - raise ValueError('Observation: {} not available for this test.'.format(observation)) - else: - self.validation_data = self.get_validation_data(band, observation) + if not observation: + print('Warning: no data file supplied, no observation requested; only catalog data will be shown.') + elif observation not in possible_observations: + raise ValueError('Observation: {} not available for this test.'.format(observation)) + else: + self.validation_data = self.get_validation_data(band, observation) - # prepare summary plot - self.summary_fig, self.summary_ax = plt.subplots() + # prepare summary plot + self.summary_fig, self.summary_ax = plt.subplots() def get_validation_data(self, band, observation): """ From b990f8595b2638568118f9f26ef4fcbfd90774b8 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Fri, 1 Jun 2018 10:47:30 -0400 Subject: [PATCH 58/74] small change --- descqa/apparent_mag_func_test.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 7c3e513d..811cf353 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -148,10 +148,10 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): N = np.cumsum(np.ones(N_tot))/sky_area # define the apparent magnitude bins for plotting purposes - self.dmag = 0.1 # bin widths + dmag = 0.1 # bin widths max_mag = self.band_lim[1] + 1.0 # go one mag beyond the limit min_mag = self.band_lim[0] - 1.0 # start at bright galaxies - mag_bins = np.arange(self.band_lim[0] ,self.band_lim[1], self.dmag) + mag_bins = np.arange(min_mag, max_mag, dmag) # calculate N( Date: Fri, 1 Jun 2018 10:48:48 -0400 Subject: [PATCH 59/74] small change --- descqa/apparent_mag_func_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 811cf353..9ef245c6 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -182,7 +182,7 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): n = self.validation_data['n( Date: Fri, 1 Jun 2018 10:50:15 -0400 Subject: [PATCH 60/74] small change --- descqa/apparent_mag_func_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 9ef245c6..97697aa9 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -203,7 +203,7 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): delta = (sampled_N-nn)/nn # find maximum fractional difference in test range - test_range_mask = (mag_bins >= self.min_band_lim) & (mag_bins <= self.max_band_lim) + test_range_mask = (mag_bins >= self.band_lim[0]) & (mag_bins <= self.band_lim[1]) max_frac_diff = np.max(delta[test_range_mask]) # apply 'passing' criterion From 12729f5582558509e12283ebf1719e6e52550590 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Wed, 6 Jun 2018 11:01:47 -0400 Subject: [PATCH 61/74] cleaned up --- descqa/apparent_mag_func_test.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 97697aa9..921becd0 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -171,12 +171,6 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): # plot mock catalog data ax_this.plot(mag_bins, sampled_N, '-', label=catalog_name) - ax_this.set_yscale('log') - ax_this.set_ylabel(r'$\rm mag$') - ax_this.set_ylabel(r'$N(<{\rm mag})~[{\rm deg}^{-2}]$') - ax_this.set_xlim([17, 30]) - ax_this.set_ylim([1, 10**8]) - # plot validation data for ax_this in [ax]: n = self.validation_data['n( Date: Wed, 6 Jun 2018 11:18:34 -0400 Subject: [PATCH 62/74] added lower diff panel --- descqa/apparent_mag_func_test.py | 54 ++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 921becd0..208a496e 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -104,16 +104,26 @@ def get_catalog_data(gc, quantities, filters=None): return data - def post_process_plot(self, ax): + def post_process_plot(self, upper_ax, lower_ax): """ """ - ax.legend(loc='upper left') - ax.set_ylabel(r'$n(< {\rm mag}) ~[{\rm deg^{-2}}]$') - ax.set_xlabel(self.band + ' magnitude') - ax.set_ylim([1000, 10**7]) - ax.fill_between([self.band_lim[0], self.band_lim[1]], [0, 0], [10**9, 10**9], alpha=0.1, color='grey') - ax.set_yscale('log') - ax.set_title(str(self.band_lim[0]) + ' < '+self.band + ' < ' + str(self.band_lim[1])) + + #upper panel + upper_ax.legend(loc='upper left') + upper_ax.set_ylabel(r'$n(< {\rm mag}) ~[{\rm deg^{-2}}]$') + upper_ax.xaxis.set_visible(False) + upper_ax.set_ylim([1000, 10**7]) + upper_ax.fill_between([self.band_lim[0], self.band_lim[1]], [0, 0], [10**9, 10**9], alpha=0.1, color='grey') + upper_ax.set_yscale('log') + upper_ax.set_title(str(self.band_lim[0]) + ' < '+self.band + ' < ' + str(self.band_lim[1])) + + #lower panel + lower_ax.set_xlabel(self.band + ' magnitude') + lower_ax.set_ylabel(r'$\Delta n/n$') + lower_ax.set_ylim([-1,1]) + lower_ax.set_yticks([-0.6,0.0,0.6]) + + def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): """ @@ -158,27 +168,27 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): mask = (inds >= len(m)) inds[mask] = -1 # take care of edge case sampled_N = N[inds] - + ################################################# # plot the cumulative apparent magnitude function ################################################# - fig, ax = plt.subplots() + fig = plt.figure() + upper_rect = 0.2,0.4,0.7,0.55 + lower_rect = 0.2,0.125,0.7,0.275 + upper_ax, lower_ax = fig.add_axes(upper_rect), fig.add_axes(lower_rect) # plot on both this plot and any summary plots - for ax_this in (ax, self.summary_ax): - - # plot mock catalog data - ax_this.plot(mag_bins, sampled_N, '-', label=catalog_name) + upper_ax.plot(mag_bins, sampled_N, '-', label=catalog_name) + self.summary_ax.plot(mag_bins, sampled_N, '-', label=catalog_name) # plot validation data - for ax_this in [ax]: - n = self.validation_data['n(= self.band_lim[0]) & (mag_bins <= self.band_lim[1]) max_frac_diff = np.max(delta[test_range_mask]) + # plot on both this plot and any summary plots + lower_ax.plot(mag_bins, delta*0.0, '-', color='black') + lower_ax.plot(mag_bins, delta, '-') + # apply 'passing' criterion if max_frac_diff>self.fractional_tol: score = max_frac_diff From 5c3f273f30c6ee2db0adba13421aaae6fceab303 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Wed, 6 Jun 2018 11:25:22 -0400 Subject: [PATCH 63/74] added lower diff panel --- descqa/apparent_mag_func_test.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 208a496e..147087d5 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -188,10 +188,6 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): upper_ax.plot(m, n, '-', label=self.validation_data['label'], color='black') upper_ax.fill_between(m, n-self.fractional_tol*n, n+self.fractional_tol*n, color='black', alpha=0.5) - self.post_process_plot(upper_ax, lower_ax) - fig.savefig(os.path.join(output_dir, 'cumulative_app_mag_plot.png')) - plt.close(fig) - ################################# # determine if the catalog passes ################################# @@ -222,6 +218,10 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): score = max_frac_diff passed = True + self.post_process_plot(upper_ax, lower_ax) + fig.savefig(os.path.join(output_dir, 'cumulative_app_mag_plot.png')) + plt.close(fig) + return TestResult(score, passed=passed) def conclude_test(self, output_dir): From 484e943af3a1afbfa9e867b30587100d7e307945 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Wed, 6 Jun 2018 11:40:03 -0400 Subject: [PATCH 64/74] adding colors --- descqa/apparent_mag_func_test.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 147087d5..17fdf3a8 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -58,6 +58,15 @@ def __init__(self, band='r', band_lim=(24.0, 27.5), fractional_tol=0.4, observat self.band_lim = list(band_lim) self.fractional_tol = fractional_tol + # set color of lines in plots + colors = plt.cm.jet(np.linspace(0,1,5)) + if band == 'g': self.line_color = colors[0] + elif band == 'r': self.line_color = colors[1] + elif band == 'i': self.line_color = colors[2] + elif band == 'z': self.line_color = colors[3] + elif band == 'y': self.line_color = colors[4] + else: self.line_color='black' + # check for validation observation if not observation: print('Warning: no data file supplied, no observation requested; only catalog data will be shown.') @@ -116,12 +125,14 @@ def post_process_plot(self, upper_ax, lower_ax): upper_ax.fill_between([self.band_lim[0], self.band_lim[1]], [0, 0], [10**9, 10**9], alpha=0.1, color='grey') upper_ax.set_yscale('log') upper_ax.set_title(str(self.band_lim[0]) + ' < '+self.band + ' < ' + str(self.band_lim[1])) + upper_ax.set_xlim([15,30]) #lower panel lower_ax.set_xlabel(self.band + ' magnitude') lower_ax.set_ylabel(r'$\Delta n/n$') lower_ax.set_ylim([-1,1]) lower_ax.set_yticks([-0.6,0.0,0.6]) + lower_ax.set_xlim([15,30]) @@ -180,7 +191,7 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): # plot on both this plot and any summary plots upper_ax.plot(mag_bins, sampled_N, '-', label=catalog_name) - self.summary_ax.plot(mag_bins, sampled_N, '-', label=catalog_name) + self.summary_ax.plot(mag_bins, sampled_N, '-', label=catalog_name, color=self.line_color) # plot validation data n = self.validation_data['n( Date: Wed, 6 Jun 2018 11:47:23 -0400 Subject: [PATCH 65/74] adding colors --- descqa/apparent_mag_func_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 17fdf3a8..91b5101d 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -218,7 +218,7 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): max_frac_diff = np.max(delta[test_range_mask]) # plot on both this plot and any summary plots - lower_ax.fill_between(mag_bins, 0.0-self.fractional_tol*mag_bins, 0.0+self.fractional_tol*mag_bins, color='black', alpha=0.5) + lower_ax.fill_between(mag_bins, 0.0*mag_bins-self.fractional_tol, 0.0*mag_bins+self.fractional_tol, color='black', alpha=0.5) lower_ax.plot(mag_bins, delta*0.0, '-', color='black') lower_ax.plot(mag_bins, delta, '-') From 98fdca14c4422962efc8453fae6307f269796747 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Wed, 6 Jun 2018 11:56:17 -0400 Subject: [PATCH 66/74] small change --- descqa/apparent_mag_func_test.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 91b5101d..d5fa82a6 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -128,6 +128,7 @@ def post_process_plot(self, upper_ax, lower_ax): upper_ax.set_xlim([15,30]) #lower panel + upper_ax.fill_between([self.band_lim[0], self.band_lim[1]], [-1, -1], [1, 1], alpha=0.1, color='grey') lower_ax.set_xlabel(self.band + ' magnitude') lower_ax.set_ylabel(r'$\Delta n/n$') lower_ax.set_ylim([-1,1]) @@ -218,8 +219,8 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): max_frac_diff = np.max(delta[test_range_mask]) # plot on both this plot and any summary plots - lower_ax.fill_between(mag_bins, 0.0*mag_bins-self.fractional_tol, 0.0*mag_bins+self.fractional_tol, color='black', alpha=0.5) - lower_ax.plot(mag_bins, delta*0.0, '-', color='black') + lower_ax.fill_between(m, 0.0*m-self.fractional_tol, 0.0*m+self.fractional_tol, color='black', alpha=0.5) + lower_ax.plot(m, m*0.0, '-', color='black') lower_ax.plot(mag_bins, delta, '-') # apply 'passing' criterion From 80596f0448402cd6463875285aa6e424ce6c2400 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Wed, 6 Jun 2018 12:00:07 -0400 Subject: [PATCH 67/74] small change --- descqa/apparent_mag_func_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index d5fa82a6..2bcbbf32 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -128,7 +128,7 @@ def post_process_plot(self, upper_ax, lower_ax): upper_ax.set_xlim([15,30]) #lower panel - upper_ax.fill_between([self.band_lim[0], self.band_lim[1]], [-1, -1], [1, 1], alpha=0.1, color='grey') + lower_ax.fill_between([self.band_lim[0], self.band_lim[1]], [-1, -1], [1, 1], alpha=0.1, color='grey') lower_ax.set_xlabel(self.band + ' magnitude') lower_ax.set_ylabel(r'$\Delta n/n$') lower_ax.set_ylim([-1,1]) From 43586141e810895cec9ad9a542c29199697d8286 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 7 Jun 2018 10:35:29 -0400 Subject: [PATCH 68/74] small change --- descqa/apparent_mag_func_test.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 2bcbbf32..97f17017 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -198,7 +198,7 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): n = self.validation_data['n( Date: Thu, 7 Jun 2018 10:40:54 -0400 Subject: [PATCH 69/74] small change --- descqa/apparent_mag_func_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 97f17017..1cbbd33a 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -216,7 +216,7 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): # find maximum fractional difference in test range test_range_mask = (mag_bins >= self.band_lim[0]) & (mag_bins <= self.band_lim[1]) - max_frac_diff = np.max(delta[test_range_mask]) + max_frac_diff = np.max(np.fabs(delta[test_range_mask])) # plot on both this plot and any summary plots lower_ax.fill_between(m, 0.0*m-self.fractional_tol, 0.0*m+self.fractional_tol, color='black', alpha=0.25) From ebeb362755abb4e423c585b1c4638dfc723a11e2 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 7 Jun 2018 10:50:57 -0400 Subject: [PATCH 70/74] fixing summary plot --- descqa/apparent_mag_func_test.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 1cbbd33a..2c8212ca 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -74,9 +74,12 @@ def __init__(self, band='r', band_lim=(24.0, 27.5), fractional_tol=0.4, observat raise ValueError('Observation: {} not available for this test.'.format(observation)) else: self.validation_data = self.get_validation_data(band, observation) - + # prepare summary plot - self.summary_fig, self.summary_ax = plt.subplots() + self.summary_fig = plt.figure() + upper_rect = 0.2,0.4,0.7,0.55 + lower_rect = 0.2,0.125,0.7,0.275 + self.summary_upper_ax, self.summary_lower_ax = fig.add_axes(upper_rect), fig.add_axes(lower_rect) def get_validation_data(self, band, observation): """ @@ -192,7 +195,7 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): # plot on both this plot and any summary plots upper_ax.plot(mag_bins, sampled_N, '-', label=catalog_name) - self.summary_ax.plot(mag_bins, sampled_N, '-', label=catalog_name, color=self.line_color) + self.summary_upper_ax.plot(mag_bins, sampled_N, '-', label=catalog_name) # plot validation data n = self.validation_data['n(self.fractional_tol: score = max_frac_diff @@ -244,10 +249,13 @@ def conclude_test(self, output_dir): # plot verifaction data on summary plot n = self.validation_data['n( Date: Thu, 7 Jun 2018 10:51:58 -0400 Subject: [PATCH 71/74] fixing summary plot --- descqa/apparent_mag_func_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 2c8212ca..89b79c0c 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -79,7 +79,7 @@ def __init__(self, band='r', band_lim=(24.0, 27.5), fractional_tol=0.4, observat self.summary_fig = plt.figure() upper_rect = 0.2,0.4,0.7,0.55 lower_rect = 0.2,0.125,0.7,0.275 - self.summary_upper_ax, self.summary_lower_ax = fig.add_axes(upper_rect), fig.add_axes(lower_rect) + self.summary_upper_ax, self.summary_lower_ax = self.summary_fig.add_axes(upper_rect), self.summary_fig.add_axes(lower_rect) def get_validation_data(self, band, observation): """ From 9fb8236eb405621a0e944c07576cc76d2ae55aaf Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 7 Jun 2018 10:53:36 -0400 Subject: [PATCH 72/74] fixing summary plot --- descqa/apparent_mag_func_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 89b79c0c..f7479475 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -226,7 +226,7 @@ def run_on_single_catalog(self, catalog_instance, catalog_name, output_dir): lower_ax.plot(m, m*0.0, '-', color='black') lower_ax.plot(mag_bins, delta, '-') - self.summary_lower_ax(mag_bins, delta, '-', label=catalog_name) + self.summary_lower_ax.plot(mag_bins, delta, '-', label=catalog_name) # apply 'passing' criterion if max_frac_diff>self.fractional_tol: From 307d0a2ae45e3b9f8c01233028a2893d98d6c252 Mon Sep 17 00:00:00 2001 From: Duncan Campbell Date: Thu, 7 Jun 2018 10:56:59 -0400 Subject: [PATCH 73/74] fixing summary plot --- descqa/apparent_mag_func_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index f7479475..9cdc9c18 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -249,8 +249,8 @@ def conclude_test(self, output_dir): # plot verifaction data on summary plot n = self.validation_data['n( Date: Thu, 7 Jun 2018 13:35:25 -0400 Subject: [PATCH 74/74] make linter happy --- descqa/apparent_mag_func_test.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/descqa/apparent_mag_func_test.py b/descqa/apparent_mag_func_test.py index 9cdc9c18..5bdb7018 100644 --- a/descqa/apparent_mag_func_test.py +++ b/descqa/apparent_mag_func_test.py @@ -4,7 +4,6 @@ from scipy.interpolate import interp1d from .base import BaseValidationTest, TestResult from .plotting import plt -from scipy.interpolate import interp1d possible_observations = { @@ -59,7 +58,7 @@ def __init__(self, band='r', band_lim=(24.0, 27.5), fractional_tol=0.4, observat self.fractional_tol = fractional_tol # set color of lines in plots - colors = plt.cm.jet(np.linspace(0,1,5)) + colors = plt.cm.jet(np.linspace(0,1,5)) # pylint: disable=no-member if band == 'g': self.line_color = colors[0] elif band == 'r': self.line_color = colors[1] elif band == 'i': self.line_color = colors[2] @@ -101,20 +100,6 @@ def get_validation_data(self, band, observation): return validation_data - @staticmethod - def get_catalog_data(gc, quantities, filters=None): - """ - """ - data = {} - if not gc.has_quantities(quantities): - return TestResult(skipped=True, summary='Missing requested quantities') - - data = gc.get_quantities(quantities, filters=filters) - - #make sure all data entries are finite - data = GCRQuery(*((np.isfinite, col) for col in data)).filter(data) - - return data def post_process_plot(self, upper_ax, lower_ax): """