Handle `None` in `ForEachObject.write`
I ran into the following problem when running write()
with write_all=True
. The problem is connected to None
s in the ForEachMosa
instance. I think ForEachObject.write
needs some modification to handle those correctly.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-33af2829abe5> in <module>
3 instrument = lisainstrument.Instrument(size=size+skipped, orbits='data/esa_orbits.h5')
4 instrument.disable_all_noises(but='laser')
----> 5 instrument.write('data/laser_only_esa.h5', write_all=True)
~/20190815_PhD_AEI/projects/instrument/lisainstrument/instrument.py in write(self, output, mode, write_all)
1472
1473 logger.debug("Writing laser noise to '%s'", output)
-> 1474 self.laser_noises.write(hdf5, 'laser_noises')
1475
1476 logger.debug("Writing clock noise to '%s'", output)
~/20190815_PhD_AEI/projects/instrument/lisainstrument/containers.py in write(self, hdf5, dataset)
70 if numpy.isscalar(value):
71 continue
---> 72 if size != 1 and len(value) != size:
73 raise ValueError(f"incompatible sizes in dictionary '{size}' and '{len(size)}'")
74 size = max(size, len(value))
TypeError: object of type 'NoneType' has no len()