Skip to content

Commit

Permalink
Merge pull request #12 from rcjackson/circleci
Browse files Browse the repository at this point in the history
Edit: remove peak2area criteria
  • Loading branch information
rcjackson authored Jun 15, 2021
2 parents 35016ad + b6100df commit 34115b8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
8 changes: 4 additions & 4 deletions examples/parallel_psds.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 1 addition & 8 deletions pysp2/util/peak_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions tests/test_gfit.py
Original file line number Diff line number Diff line change
@@ -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(
Expand All @@ -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)

0 comments on commit 34115b8

Please sign in to comment.