File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -3421,21 +3421,29 @@ def save(self, **kwargs):
3421
3421
3422
3422
3423
3423
def _numpy_eval_expr (expression , operands , prefer_blosc = False ):
3424
- ops = (
3425
- {
3424
+ if prefer_blosc :
3425
+ # convert blosc arrays to small dummies
3426
+ ops = {
3426
3427
key : blosc2 .ones ((1 ,) * len (value .shape ), dtype = value .dtype )
3427
3428
if hasattr (value , "chunks" )
3428
- else value
3429
+ else value # some of these could be numpy arrays
3429
3430
for key , value in operands .items ()
3430
3431
}
3431
- if prefer_blosc
3432
- else {
3432
+ # change numpy arrays
3433
+ ops = {
3434
+ key : np .ones ((1 ,) * len (value .shape ), dtype = value .dtype )
3435
+ if isinstance (value , np .ndarray )
3436
+ else value
3437
+ for key , value in ops .items ()
3438
+ }
3439
+ else :
3440
+ ops = {
3433
3441
key : np .ones (np .ones (len (value .shape ), dtype = int ), dtype = value .dtype )
3434
3442
if hasattr (value , "shape" )
3435
3443
else value
3436
3444
for key , value in operands .items ()
3437
3445
}
3438
- )
3446
+
3439
3447
if "contains" in expression :
3440
3448
_out = ne_evaluate (expression , local_dict = ops )
3441
3449
else :
You can’t perform that action at this time.
0 commit comments