czbiohub-sf / shrimPy

shrimPy: Smart High-throughput Robust Imaging & Measurement in Python
BSD 3-Clause "New" or "Revised" License
8 stars 1 forks source link

Plot bleaching estimates with correct time and/or per volume units #96

Open talonchandler opened 1 year ago

talonchandler commented 1 year ago

The current estimate-bleaching routine looks for Interval_ms metadata which is not always present.

I'll propose that we make two changes to fix this issue:

This will allow us enough flexibility to plot in units of "per second" or "per volume", and it does not depend on iohub correct passing to time metadata which is planned for after the universal API.

ieivanov commented 1 year ago

Makes sense to me

edyoshikun commented 1 year ago

adding to this, I just realized that a failure mode fo this is when dt gets parsed as 0.0 from the plate metadata. The default behavior should be 1.0 so that T*dt can still generate the array. Otherwise we get the following:

try:
    dt = np.float32(plate_zattrs['Summary']['Interval_ms'] / MSECS_PER_MINUTE)
except Exception as e:
    print(e)
    dt = 1
    warnings.warn(f"WARNING: missing time metadata for p={well_name}")
times = np.arange(0, T * dt, step=dt)
output_file = os.path.join(output_dirpath, well_name)
os.makedirs(output_file, exist_ok=True)

ValueError: arange: cannot compute length