Skip to content

Commit

Permalink
BUG: fix issue with how 'param_samples' was being compared to None.
Browse files Browse the repository at this point in the history
If the array is a normal array then the '==' comparison fails.
  • Loading branch information
lzkelley committed May 1, 2024
1 parent 8bfddfe commit 8a93b1c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions holodeck/librarian/combine.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ def sam_lib_combine(

log.info(f"loaded param space: {pspace} from '{pspace_fname}'")
param_names = pspace.param_names
param_samples = pspace.param_samples
param_samples = pspace.param_samples[()]

# Standard Library: vary all parameters together
if library:
if param_samples == None: # noqa : use `== None` to match arrays
if param_samples is None:
log.error(f"`library`={library} but `param_samples`={param_samples}`")
err = f"`library` is True, but {path_output} looks like it's a domain."
raise DomainNotLibraryError(err)
Expand All @@ -155,7 +155,7 @@ def sam_lib_combine(
# Domain: Vary only one parameter at a time to explore the domain
else:
err = f"Expected 'domain' but `param_samples`={param_samples} is not `None`!"
assert param_samples == None, err # noqa : use `== None` to match arrays
assert param_samples is None, err
ndim = pspace.nparameters
# for 'domain' simulations, this is the number of samples in each dimension
nsamp_dim = args.nsamples
Expand Down
2 changes: 1 addition & 1 deletion holodeck/librarian/lib_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def from_save(cls, fname, log=None):
pspace_class = cls

# construct instance with dummy/temporary values (which will be overwritten)
if data['param_samples'] == None: # noqa : use ``== None`` to match arrays
if data['param_samples'][()] is None:
nsamples = None
nparameters = None
else:
Expand Down

0 comments on commit 8a93b1c

Please sign in to comment.