Openskin: calculation stops with error if kVp is missing

Issue #558 resolved
Luuk
created an issue

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)

  1. Luuk reporter

    Refs #558 Openskin: calculation stops with error if kVp is missing

    Implemented try / except blocks around multiple parameters Not only ObjectDoesNotExist, but for the parameters converted to float also TypeError

    Test file added.

    → <<cset b49b1204e8b1>>

  2. Log in to comment