DC-analysis / dclab

Python library for the post-measurement analysis of real-time deformability cytometry (RT-DC) data sets
https://dclab.readthedocs.io
Other
10 stars 12 forks source link

emodulus calculation in hierarchy child #92

Open lucaswittwer opened 3 years ago

lucaswittwer commented 3 years ago

Description: Calculating the auxilliary feature emodulus in a hierarchy child of a RTDCBase data set does not work:

# doing some filtering on data set `ds`
ds.apply_filter()

dsf=dclab.new_dataset(ds)

dsf.config["calculation"]["emodulus lut"] = "LE-2D-FEM-19"
dsf.config["calculation"]["emodulus medium"] = dsf.config["setup"]["medium"]
dsf.config["calculation"]["emodulus temperature"] = 23.0

print('emodulus' in dsf)

prints False

Calculating the emodulus based on the data set ds works and is propagated to the dsf data set too. I think it would be nice to trigger the calculation of such features in a hierarchy child too.

paulmueller commented 3 years ago

This would be a nice feature indeed. Question is how to implement it. The current analysis pipeline demands that hierarchy children inherit all feature data from their parents.

lucaswittwer commented 3 years ago

Haven't looked into the implementation yet, adding a warning (with a hint how to get the emodulus into a child dataset) would be a good start I think.

Does the child "know" its parents? If so, triggering the computation in the parent would be a workaround.

paulmueller commented 3 years ago

The child knows its parent: https://github.com/ZELLMECHANIK-DRESDEN/dclab/blob/master/dclab/rtdc_dataset/fmt_hierarchy.py#L234-L235

We have to keep these things in mind:

I think the best solution for now would be to raise an exception if anyone tries to set CFG_ANALYSIS["calculation"] keywords for a hierarchy child.

felix-r commented 2 years ago

I just came across this problem again and it took me a while to figure out what I was doing wrong. So, it would be nice to get an exception when trying to perform the emodulus calculation for a hierachy child with the explanation that the emodulus can only be computed for the original dataset. Right now you get the exception KeyError: "Feature 'emodulus' does not exist in <RTDC_HDF5 ... which is just frustrating.

paulmueller commented 2 years ago

I made the error message more verbose, but this issue should stay open.