Handle the DA:ALL column header in MIDAS files
Closed this issue · 2 comments
Hi,
Thanks for your tool.
In caspots
, you are currently retrieving the time steps in caspots/dataset.py
(l. 142) using
time = int(row.get("DA:%s" % var))
The documentation of CNO
(https://saezlab.github.io/cellnopt/6_CNODocs/) mentions a DA:ALL
column header for the cases where all the species have been measured at the same time step.
With the current version of the code, using DA:ALL
leads to the following type error :
TypeError: int() argument must be a string or a number, not 'NoneType'
because the var
variable does not exist, so nothing is catch by the row.get
, so the integer casting cannot be done.
Hence, I propose the following modification for it to handle it :
try:
time = int(row.get("DA:%s" % var))
except (TypeError):
time = int(row.get("DA:ALL"))
Best,
nanls
Thanks, the commit I did should fix it. keep me in touch
Nice fix, thanks. :)