CAREamics / careamics

A deep-learning library for N2V and friends
https://careamics.github.io/
BSD 3-Clause "New" or "Revised" License
30 stars 6 forks source link

refac: refactored serialization of arrays for noise model and likelihood configs #232

Closed federico-carrara closed 2 months ago

federico-carrara commented 2 months ago

Description

Changes Made

For further discussion

NOTE1: why deserializer takes in a list? Because in our use case we need deserializers to move config files usually stored as dicts into pydantic models. But, such dicts are often the result of loading config file mainly stored as json, pkl, or yml. The loader for these file types automatically deserialize strings into lists. That's why what is left to do for us is to move lists into arrays or tensors.

NOTE2: why 2 different deserializers? Because in some cases we want to deserialize list to torch tensor and in some other cases we prefer numpy arrays.

After discussing with @jdeschamps we realized that some large arrays should not be part of configs (e.g., signal, observation in nm_model.py). Therefore, I left TODOs to remind about discussing this for future refactoring.


Please ensure your PR meets the following requirements:

jdeschamps commented 2 months ago

Ping me when you have the deserializer in the PR, so we can review it!

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 87.23%. Comparing base (427fa26) to head (5264466). Report is 6 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #232 +/- ## ========================================== + Coverage 87.20% 87.23% +0.03% ========================================== Files 130 131 +1 Lines 4876 4897 +21 ========================================== + Hits 4252 4272 +20 - Misses 624 625 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.