@@ -611,12 +611,11 @@ def _prune_and_rename(
611
611
],
612
612
}
613
613
for channel in self ['channels' ]
614
+ # we want to remove channels only if no samples or modifiers are to be pruned
614
615
if channel ['name' ] not in prune_channels
615
- or ( # we only want to remove this channel if we did not specify any samples or modifiers to prune
616
- prune_samples != []
617
- or prune_modifiers != []
618
- or prune_modifier_types != []
619
- )
616
+ or prune_samples
617
+ or prune_modifiers
618
+ or prune_modifier_types
620
619
],
621
620
'measurements' : [
622
621
{
@@ -634,9 +633,11 @@ def _prune_and_rename(
634
633
for parameter in measurement ['config' ][
635
634
'parameters'
636
635
] # we only want to remove this parameter if measurement is in prune_measurements or if prune_measurements is empty
636
+ # we want to remove parameters from a measurement only
637
+ # if measurement is not in keep_measurements
637
638
if (
638
- measurement [ 'name' ] not in prune_measurements
639
- and prune_measurements != []
639
+ prune_measurements
640
+ and measurement [ 'name' ] not in prune_measurements
640
641
)
641
642
or parameter ['name' ] not in prune_modifiers
642
643
],
@@ -646,22 +647,21 @@ def _prune_and_rename(
646
647
},
647
648
}
648
649
for measurement in self ['measurements' ]
649
- if measurement ['name' ] not in prune_measurements
650
- or prune_modifiers
651
- != [] # we only want to remove this measurement if we did not specify parameters to remove
650
+ # we want to remove measurements only if no parameters are to be pruned
651
+ if measurement ['name' ] not in prune_measurements or prune_modifiers
652
652
],
653
653
'observations' : [
654
654
dict (
655
655
copy .deepcopy (observation ),
656
656
name = rename_channels .get (observation ['name' ], observation ['name' ]),
657
657
)
658
658
for observation in self ['observations' ]
659
+ # we want to remove this channels only
660
+ # if no samples or modifiers are to be pruned
659
661
if observation ['name' ] not in prune_channels
660
- or ( # we only want to remove this channel if we did not specify any samples or modifiers to prune
661
- prune_samples != []
662
- or prune_modifiers != []
663
- or prune_modifier_types != []
664
- )
662
+ or prune_samples
663
+ or prune_modifiers
664
+ or prune_modifier_types
665
665
],
666
666
'version' : self ['version' ],
667
667
}
0 commit comments