Skip to content

Commit

Permalink
Fix deprecation warning for tuple conditions in new version of numpy
Browse files Browse the repository at this point in the history
  • Loading branch information
mwshinn committed Aug 15, 2021
1 parent b7c084e commit 0e60192
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ddm/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ def solve_partial_conditions(model, sample=None, conditions=None, method=None):
# conditions
if len(cond_combs) == 1:
cond_combs = cond_combs + cond_combs
samp = Sample.from_numpy_array(np.asarray(cond_combs), all_conds)
samp = Sample.from_numpy_array(np.asarray(cond_combs, dtype=object), all_conds)
model_corr = 0*model.t_domain()
model_err = 0*model.t_domain()
model_undec = -1 # Set to dummy value -1 so we can detect this in our loop
Expand Down
2 changes: 0 additions & 2 deletions ddm/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,6 @@ def setter(x,a,pv=pv,component=component,param_name=param_name):
def update():
"""Redraws the plot according to the current parameters of the model
and the selected conditions."""
print("cond var vals", condition_vars_values)
print("cond vars", condition_vars)
current_conditions = {c : condition_vars_values[i][condition_vars[i].get()] for i,c in enumerate(required_conditions) if condition_vars[i].get() != "All"}
# If any conditions were "all", they will not be in current
# conditions. Here, we update current_conditions with any
Expand Down
4 changes: 2 additions & 2 deletions ddm/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def from_numpy_array(data, column_names):
c = data[:,1].astype(bool)
nc = (1-data[:,1]).astype(bool)
def pt(x): # Pythonic types
arr = np.asarray(x)
arr = np.asarray(x, dtype=object)
# The following is somewhat of a hack to get rid of object arrays
# when a condition is not a number (e.g. string or tuple)
if len(arr) > 0 and not isinstance(arr[0], (float, int, np.float_, np.int_)):
Expand Down Expand Up @@ -216,7 +216,7 @@ def from_pandas_dataframe(df, rt_column_name, correct_column_name):
c = df[correct_column_name].astype(bool)
nc = (1-df[correct_column_name]).astype(bool)
def pt(x): # Pythonic types
arr = np.asarray(x)
arr = np.asarray(x, dtype=object)
# The following is somewhat of a hack to get rid of object arrays
# when a condition is not a number (e.g. string or tuple)
if len(arr) > 0 and not isinstance(arr[0], (float, int, np.float_, np.int_)):
Expand Down

0 comments on commit 0e60192

Please sign in to comment.