cutright / IMRT-QA-Data-Miner

Scans a directory for IMRT QA results
MIT License
13 stars 5 forks source link

Skip over invalid data in trending #15

Closed mchamberland closed 4 years ago

mchamberland commented 4 years ago

The following two lines (here and here) raise a ValueError when the conversion to float fails.

What do you think of the following fix?

if 'Any' in active_gamma or gamma_crit in active_gamma:
   try:
      y_float = float(self.data[select_y.value][i])
   except ValueError:
      continue
   new_data['x'].append(self.x[i])
   new_data['y'].append(y_float)
   new_data['id'].append(self.data['Patient ID'][i])
mchamberland commented 4 years ago

This comes from the gamma index statistics in my SNC Patient reports. If the statistics were not calculated, they are set to 'n/a' or 'NA'.

mchamberland commented 4 years ago

To save a line, we could also do:

if 'Any' in active_gamma or gamma_crit in active_gamma:
   try:
      new_data['y'].append(float(self.data[select_y.value][i]))
   except ValueError:
      continue
   new_data['x'].append(self.x[i])
   new_data['id'].append(self.data['Patient ID'][i])
cutright commented 4 years ago

Went ahead and pushed that fix to master. Thanks!