Open
Description
I've run into an error when building a CAOM observation in caom2=2.3.5. For an observation with two filters, I create a Plane.energy.bounds object as an Interval with max/min energy wavelengths and samples for each individual filter. However, because the filter coverage overlaps, I get an error:
from caom2.shape import Interval
from caom2.shape import SubInterval
all_list = []
samples = []
start, end = 5e-7, 5e-6
samples.append(SubInterval(start, end))
all_list.append(start)
all_list.append(end)
start, end = 6e-7, 2.8e-6
samples.append(SubInterval(start, end))
all_list.append(start)
all_list.append(end)
finalStart = min(all_list)
finalEnd = max(all_list)
bounds = Interval(finalStart, finalEnd, samples=samples)
Traceback (most recent call last):
File "/Users/drodriguez/anaconda3/envs/caom2/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2881, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-41-9262c1aac55b>", line 1, in <module>
bounds = Interval(finalStart, finalEnd, samples=samples)
File "/Users/drodriguez/data/CAOM/pyCAOM2/caom2/shape.py", line 255, in __init__
self.validate()
File "/Users/drodriguez/data/CAOM/pyCAOM2/caom2/shape.py", line 353, in validate
'sample:\n{}\nvs\n{}'.format(sample, prev))
AssertionError: invalid interval: sample overlaps previous sample:
SubInterval.lower : 6e-07
SubInterval.upper : 2.8e-06
vs
SubInterval.lower : 5e-07
SubInterval.upper : 5e-06
In this case, one filter is entirely within another so perhaps the error is valid, but this makes it sound like any overlapping filters will give an error and this can be quite common. Or are SubInterval samples meant to be used in a different way?
Metadata
Metadata
Assignees
Labels
No labels