Skip to content

Can't add a CalPoint to a SensitivityList  #8

@ScottSoren

Description

@ScottSoren

A normal workflow in ixdat with siq is:

from ixdat import plugins, Measurement

plugins.activate_siq()
meas = Measurement.read("my_data.tsv")

cal_1 = meas.siq_calibration_method_1(...)
cal_2 = meas.siq_calibration_method_2(...)
cal_3 = meas.siq_calibration_method_3(...)

calibration = cal_1 + cal_2 + cal_3   # raises an Error! :( 

Where cal_1, cal_2, and cal_3 are all CalPoints.

The error is TypeError: SensitivityList.__init__() got an unexpected keyword argument 'sensitivity_list'
It arises because the + operator is implemented such that it works for Calibration and CalPoint but not for SensitivityList and CalPoint.

Workarounds:

For the above example, you could directly define the Calibration:

calibration = plugins.siq.Calibration(cal_list=[cal_1, cal_2, cal_3])

You also convert the SensitivityList to a Calibration before adding additional CalPoints:

calibration_partial = cal_1 + cal_2
calibration_partial = plugins.siq.Calibration(cal_list=calibration_partial.sf_list)  
calibration = calibration_partial + cal_3  # works now! 

However, neither of these feel like a smooth integration of ixdat and siq.

Ways to fix it:

(1) Make sure that addition of two CalPoints results in a Calibration, not a SensitivityList
(2) Modify SensitivityList.__add__ such that addition of a CalPoint to a SensitivityList returns a Calibration
(3) This raises the question of whether SensitivityList, which is a base class for Calibration, serves a purpose. It arose out of the need to make siq more modular in its early days (and conceptually separate the calibration and quantification workflows). But the separation is counterintuitive in some cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions