spacetelescope / STScI-STIPS

STScI-STIPS
https://stips.readthedocs.io
14 stars 16 forks source link

Make ObservationModule iterable #153

Open york-stsci opened 3 years ago

york-stsci commented 3 years ago

Currently, in order to use an ObservationModule, it must be created, then nextObservation() must be called, then the observation must be run, and nextObservation() called again until it returns None. Instead, this would add an iter method that includes yield, so that it could be done as:

obm = ObservationModule(obs=obs_dict) for observation in obm: observation.add_catalogue(catalogue) observation.add_error() observation.finalize()

which is both more pythonic and probably makes more sense.