- changed milestone to 0.8.0
Openskin: calculation stops with error if kVp is missing
If kVp is missing the calculation the raised exception isn't caught and will crash.
This might be the case for more parameters.
Suggestion for change in the case of kVp. In make_skin_map in make_skin_map.py change:
if irrad.irradeventxraysourcedata_set.get().kvp_set.get().kvp:
kvp = float(irrad.irradeventxraysourcedata_set.get().kvp_set.get().kvp)
else:
kvp = None
to
if irrad.irradeventxraysourcedata_set.get().kvp_set.exists() and \
irrad.irradeventxraysourcedata_set.get().kvp_set.get().kvp:
kvp = float(irrad.irradeventxraysourcedata_set.get().kvp_set.get().kvp)
else:
kvp = None
Comments (6)
-
-
My preferred approach to these things now is to do the thing within a
try
, then catch theObjectDoesNotExist
for the alternative. -
Do you have sample data with missing kV so we can throw some tests in to ensure it stays fixed once fixed?
-
reporter Refs
#558Openskin: calculation stops with error if kVp is missingImplemented try / except blocks around multiple parameters Not only ObjectDoesNotExist, but for the parameters converted to float also TypeError
Test file added.
→ <<cset b49b1204e8b1>>
-
Adding ref
#558to changes→ <<cset 86a5424b98eb>>
-
- changed status to resolved
Merged in Issue558SkinMapStopsOnNoKvp (pull request #127)
Fixes
#558Openskin: calculation stops with error if kVp is missingI'd like to see further changes to this code as per ref #563, but this PR is better than the current code for several reasons so we'll merge this in :-)
→ <<cset 6559337e3596>>
- Log in to comment