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

Config JSON matrices format #272

Open
KristinaUlicna opened this issue Jun 24, 2022 · 4 comments
Open

Config JSON matrices format #272

KristinaUlicna opened this issue Jun 24, 2022 · 4 comments

Comments

@KristinaUlicna
Copy link
Contributor

When I export the configuration into the json file using the Save configuration button, the motion model matrices are not written out in the 2D matrix form, but in number-per-line format (see picture below). Their values are 100% correct, but it's visually difficult to check the matrix for symmetry & see its diagonal values. Could we re-format this?

Screenshot 2022-06-24 at 16 17 16

@p-j-smith
Copy link
Collaborator

This is to do with how json files are written in general. If you write a config file using BayesianTracker directly rather than through the gui:

import btrack
from btrack import datasets

config_file = btrack.datasets.cell_config()
config = btrack.config.load_config(config_file)
btrack.config.save_config('test_config.json', config)

you'll get the same result. Maybe there's a library we can use to format the json nicely, or perhaps it's possible by writing a custom json encoder to pass to pydantic, but I'm not sure.

Should we move this issue to the main BayesianTracker repo?

@paddyroddy
Copy link
Collaborator

Alternatively, could we store these "matrices" as matrices, i.e. 2D lists?

@p-j-smith
Copy link
Collaborator

we could but there would still be only one element per line not one sub-list per line, so it would be the same looking file just with more square brackets and indentation. We'd still need to write a custom encoder to write it nicely.

Plus changing the way the config files are written might break things for a lot of people, unless we support reading both the current format and a new format with 2d lists

@paddyroddy
Copy link
Collaborator

Agreed it would be a drastic change but I personally don't think it is worth the effort if we keep them as 1D lists.

@paddyroddy paddyroddy transferred this issue from lowe-lab-ucl/napari-btrack Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants