Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Measurement bug in 3D Fractal measurements #79

Closed
jluethi opened this issue Jun 15, 2023 · 2 comments · Fixed by #81
Closed

Measurement bug in 3D Fractal measurements #79

jluethi opened this issue Jun 15, 2023 · 2 comments · Fixed by #81

Comments

@jluethi
Copy link
Contributor

jluethi commented Jun 15, 2023

In the latest update, something with how we're building the dataframes in the Fractal task has broken, leading to this error when we try to do a 3D measurement:

Traceback (most recent call last):
  File "/tungstenfs/landing/fractal/1016-main-cluster-postgres/FRACTAL_TASKS_DIR/.fractal/scmultiplex0.4.dev44+g36bca79/venv/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3802, in get_loc
    return self._engine.get_loc(casted_key)
  File "pandas/_libs/index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 165, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 5745, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 5753, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'label'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/tungstenfs/landing/fractal/1016-main-cluster-postgres/FRACTAL_TASKS_DIR/.fractal/scmultiplex0.4.dev44+g36bca79/venv/lib/python3.9/site-packages/scmultiplex/fractal/scmultiplex_feature_measurements.py", line 371, in <module>
    run_fractal_task(
  File "/tungstenfs/landing/fractal/1016-main-cluster-postgres/FRACTAL_TASKS_DIR/.fractal/scmultiplex0.4.dev44+g36bca79/venv/lib/python3.9/site-packages/fractal_tasks_core/_utils.py", line 91, in run_fractal_task
    metadata_update = task_function(**task_args.dict(exclude_unset=True))
  File "/tungstenfs/landing/fractal/1016-main-cluster-postgres/FRACTAL_TASKS_DIR/.fractal/scmultiplex0.4.dev44+g36bca79/venv/lib/python3.9/site-packages/scmultiplex/fractal/scmultiplex_feature_measurements.py", line 318, in scmultiplex_measurements
    if not (df_well["label"] == df_info_well["label"]).all():
  File "/tungstenfs/landing/fractal/1016-main-cluster-postgres/FRACTAL_TASKS_DIR/.fractal/scmultiplex0.4.dev44+g36bca79/venv/lib/python3.9/site-packages/pandas/core/frame.py", line 3807, in __getitem__
    indexer = self.columns.get_loc(key)
  File "/tungstenfs/landing/fractal/1016-main-cluster-postgres/FRACTAL_TASKS_DIR/.fractal/scmultiplex0.4.dev44+g36bca79/venv/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3804, in get_loc
    raise KeyError(key) from err
KeyError: 'label'

My suspicion is that we're merging dataframes in a way where they had 2 label columns and those then got renamed to label_1 & label_2 or something like that.

I will dig into it and will try to add some automated testing for the fractal tasks, such that we'd spot such issues earlier.

@jluethi
Copy link
Contributor Author

jluethi commented Jun 15, 2023

Hmm, funny. I now built 2D & 3D tests on a small OME-Zarr file (see https://github.com/fmi-basel/gliberal-scMultipleX/tree/fractal-testing). But all the tests pass fine, I can't reproduce the bug from Clara above. Need to investigate a bit further.

Next steps:

  1. Get the example data from Clara locally and test there
  2. Verify that the Fractal task on the FMI Fractal server is actually up-to-date

@jluethi
Copy link
Contributor Author

jluethi commented Jun 16, 2023

After all the digging and the adding of tests: The issue was that the Fractal task didn't handle an empty image correctly. Now also being added with #81 . I'll run the tests on the cluster to see that the workflow really works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant