Skip to content

Commit

Permalink
Update modifier.py - sample order check
Browse files Browse the repository at this point in the history
Include the case where min train order can be larger than max sample order as well.
  • Loading branch information
stewu5 committed Mar 1, 2022
1 parent 8122f90 commit 7c8f9ef
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions xenonpy/inverse/iqspr/modifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,18 @@ def _fit_sample_order(self):
(self.sample_order[1], self._train_order[1]), RuntimeWarning)
self.sample_order = (self.sample_order[0], self._train_order[1])
if self._train_order and self._train_order[0] > self.sample_order[0]:
warnings.warn(
'min <sample_order>: %s is smaller than min <train_order>: %s,'
'min <sample_order> will be increased to min <train_order>' %
(self.sample_order[0], self._train_order[0]), RuntimeWarning)
self.sample_order = (self._train_order[0], self.sample_order[1])
if self._train_order[0] > self.sample_order[1]:
warnings.warn(
'max <sample_order>: %s is smaller than min <train_order>: %s,'
'<sample_order> will be replaced by the values of <train_order>' %
(self.sample_order[1], self._train_order[0]), RuntimeWarning)
self.sample_order = (self._train_order[0], self._train_order[1])
else:
warnings.warn(
'min <sample_order>: %s is smaller than min <train_order>: %s,'
'min <sample_order> will be increased to min <train_order>' %
(self.sample_order[0], self._train_order[0]), RuntimeWarning)
self.sample_order = (self._train_order[0], self.sample_order[1])

def _fit_min_len(self):
if self.sample_order[0] > self.min_len:
Expand Down

0 comments on commit 7c8f9ef

Please sign in to comment.