From d04159bc290d45b4567c5fd3329c97d3a01cf787 Mon Sep 17 00:00:00 2001 From: Bobby Jackson Date: Tue, 15 Jun 2021 15:28:44 -0400 Subject: [PATCH 1/2] Edit: remove peak2area criteria --- examples/parallel_psds.py | 8 ++++---- pysp2/util/peak_fit.py | 9 +-------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/examples/parallel_psds.py b/examples/parallel_psds.py index bf181f0..706514f 100644 --- a/examples/parallel_psds.py +++ b/examples/parallel_psds.py @@ -111,12 +111,12 @@ def process_day(my_day): client = Client(cluster) print("Waiting for workers before starting processing...") - client.wait_for_workers(9) + #client.wait_for_workers(9) #for day in sp2_date_list: # print("Processing %s" % day) # process_day(day) #print(sp2_date_list) - #process_day('20200218') - results = client.map(process_day, sp2_date_list) - wait(results) + process_day('20191216') + #results = client.map(process_day, sp2_date_list) + #wait(results) del client diff --git a/pysp2/util/peak_fit.py b/pysp2/util/peak_fit.py index 56ba9d6..1ab3866 100644 --- a/pysp2/util/peak_fit.py +++ b/pysp2/util/peak_fit.py @@ -455,15 +455,8 @@ def _fit_record_incan_ave_base(my_ds, channel, num_trig_pts): denominator = np.sum(data2[:, 20:81], axis=1) peak2area = np.max(data2, axis=1)/denominator - if channel in [1, 5]: - upperbound = 100000. - lowerbound = 0.063 - else: - upperbound = 1000000. - lowerbound = -1000000. - conditions = np.logical_and.reduce( - (V_max - base > 1, V_maxloc > 0, V_maxloc < data.shape[1], peak2area > lowerbound, peak2area < upperbound)) + (V_max - base > 1, V_maxloc > 0, V_maxloc < data.shape[1])) height = np.where(conditions, V_max - base, np.nan) pos = np.where(conditions, V_maxloc, np.nan) base = np.where(conditions, base, np.nan) From b6100df9926876a1963ee1541d7cc5f563617fb3 Mon Sep 17 00:00:00 2001 From: Bobby Jackson Date: Tue, 15 Jun 2021 15:33:00 -0400 Subject: [PATCH 2/2] TST: Change unit tests to correspond to actual correct answers. --- tests/test_gfit.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_gfit.py b/tests/test_gfit.py index c823df0..54e1368 100644 --- a/tests/test_gfit.py +++ b/tests/test_gfit.py @@ -1,11 +1,12 @@ import pysp2 import numpy as np + def test_gaussian_fit(): my_sp2b = pysp2.io.read_sp2(pysp2.testing.EXAMPLE_SP2B) my_ini = pysp2.io.read_config(pysp2.testing.EXAMPLE_INI) my_binary = pysp2.util.gaussian_fit(my_sp2b, my_ini, parallel=False) - assert my_binary.PkHt_ch1.max() == 62666.6 + assert my_binary.PkHt_ch1.max() == 62669.4 np.testing.assert_almost_equal( np.nanmax(my_binary.PkHt_ch0.values), 98708.92915295, decimal=1) np.testing.assert_almost_equal( @@ -21,4 +22,4 @@ def test_psds(): assert np.nanmax( my_binary['ScatDiaBC50'].values[ScatRejectKey == 0]) < 1000. my_psds = pysp2.util.process_psds(my_binary, my_hk, my_ini) - np.testing.assert_almost_equal(my_psds['NumConcIncan'].max(), 0.69192748) + np.testing.assert_almost_equal(my_psds['NumConcIncan'].max(), 0.95805343)