From 17a1286855ef4a5a8bd85a7e2d6daea132fff7de Mon Sep 17 00:00:00 2001 From: "R. Biswas" Date: Thu, 2 Aug 2018 11:17:51 +0200 Subject: [PATCH 1/2] Added a version dependent switch for working with `isin` and in1d` modified: opsimsummary/opsim_out.py modified: opsimsummary/version.py --- opsimsummary/opsim_out.py | 9 +++++++-- opsimsummary/version.py | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/opsimsummary/opsim_out.py b/opsimsummary/opsim_out.py index 081192c..ab3de3d 100644 --- a/opsimsummary/opsim_out.py +++ b/opsimsummary/opsim_out.py @@ -546,8 +546,13 @@ def dropDuplicates(df, propIDDict, opsimversion): orig_propID = df.propID.values df['orig_propID'] = orig_propID - ddfmask = np.isin(df.propID, ddfID) - wfdmask = np.isin(df.propID, wfdID) + if np.__version__ >= 1.13: + ddfmask = np.isin(df.propID, ddfID) + wfdmask = np.isin(df.propID, wfdID) + else: + ddfmask = np.in1d(df.propID, ddfID) + wfdmask = np.in1d(df.propID, wfdID) + df.loc[ddfmask, 'propID'] = ddfPropID df.loc[wfdmask, 'propID'] = wfdPropID diff --git a/opsimsummary/version.py b/opsimsummary/version.py index cca0642..11e644f 100644 --- a/opsimsummary/version.py +++ b/opsimsummary/version.py @@ -1 +1 @@ -__VERSION__ = "1.19.1" +__VERSION__ = "1.19.2" From 9ef2956b51974f232bc9114f1cf4a5d2968174ed Mon Sep 17 00:00:00 2001 From: "R. Biswas" Date: Thu, 2 Aug 2018 12:58:39 +0200 Subject: [PATCH 2/2] Removed version dependence and changed it to use `in1d` always. modified: opsim_out.py modified: version.py --- opsimsummary/opsim_out.py | 12 ++++++------ opsimsummary/version.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/opsimsummary/opsim_out.py b/opsimsummary/opsim_out.py index ab3de3d..ec053eb 100644 --- a/opsimsummary/opsim_out.py +++ b/opsimsummary/opsim_out.py @@ -546,12 +546,12 @@ def dropDuplicates(df, propIDDict, opsimversion): orig_propID = df.propID.values df['orig_propID'] = orig_propID - if np.__version__ >= 1.13: - ddfmask = np.isin(df.propID, ddfID) - wfdmask = np.isin(df.propID, wfdID) - else: - ddfmask = np.in1d(df.propID, ddfID) - wfdmask = np.in1d(df.propID, wfdID) + # if np.__version__ >= 1.13: + # ddfmask = np.isin(df.propID, ddfID) + # wfdmask = np.isin(df.propID, wfdID) + # else: + ddfmask = np.in1d(df.propID, ddfID) + wfdmask = np.in1d(df.propID, wfdID) df.loc[ddfmask, 'propID'] = ddfPropID df.loc[wfdmask, 'propID'] = wfdPropID diff --git a/opsimsummary/version.py b/opsimsummary/version.py index 11e644f..fc89c4a 100644 --- a/opsimsummary/version.py +++ b/opsimsummary/version.py @@ -1 +1 @@ -__VERSION__ = "1.19.2" +__VERSION__ = "1.19.3"