simularium / simulariumio

Python package that converts simulation outputs to the format consumed by the Simularium viewer website
Apache License 2.0
5 stars 3 forks source link

Feature/auto handle scale factor #148

Closed ascibisz closed 1 year ago

ascibisz commented 1 year ago

Problem

It's confusing for users to have to come up with an appropriate scale factor that'll look good in the simularium viewer. Instead, simulariumio should be able to choose an appropriate scale factor based on the spatial positions. Link to ticket

Solution

Based on manually trying on different scale factors and seeing what positional ranges looked bad, I decided the viewer's ideal range is 5-70, so I made a new constant for that. In each of the converters, I kept track of the ranges of the XYZ coordinates when spatial data is being processed, and then come up with a scale factor accordingly. I then scale radii, positions, subpoints, and box size accordingly. If a scale factor was provided, that will still be used instead of the calculated one, to maintain previous functionality.

Type of change

codecov-commenter commented 1 year ago

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (983c99b) 92.56% compared to head (fa8ab17) 92.74%.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #148 +/- ## ========================================== + Coverage 92.56% 92.74% +0.18% ========================================== Files 101 101 Lines 4546 4673 +127 ========================================== + Hits 4208 4334 +126 - Misses 338 339 +1 ``` | [Files](https://app.codecov.io/gh/simularium/simulariumio/pull/148?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | | |---|---|---| | [simulariumio/constants.py](https://app.codecov.io/gh/simularium/simulariumio/pull/148?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c2ltdWxhcml1bWlvL2NvbnN0YW50cy5weQ==) | `100.00% <100.00%> (ø)` | | | [simulariumio/cytosim/cytosim\_converter.py](https://app.codecov.io/gh/simularium/simulariumio/pull/148?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c2ltdWxhcml1bWlvL2N5dG9zaW0vY3l0b3NpbV9jb252ZXJ0ZXIucHk=) | `97.12% <100.00%> (+0.04%)` | :arrow_up: | | [simulariumio/data\_objects/meta\_data.py](https://app.codecov.io/gh/simularium/simulariumio/pull/148?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c2ltdWxhcml1bWlvL2RhdGFfb2JqZWN0cy9tZXRhX2RhdGEucHk=) | `97.43% <100.00%> (ø)` | | | [simulariumio/mcell/mcell\_converter.py](https://app.codecov.io/gh/simularium/simulariumio/pull/148?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c2ltdWxhcml1bWlvL21jZWxsL21jZWxsX2NvbnZlcnRlci5weQ==) | `99.45% <100.00%> (+<0.01%)` | :arrow_up: | | [simulariumio/md/md\_converter.py](https://app.codecov.io/gh/simularium/simulariumio/pull/148?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c2ltdWxhcml1bWlvL21kL21kX2NvbnZlcnRlci5weQ==) | `96.11% <100.00%> (+0.03%)` | :arrow_up: | | [simulariumio/medyan/medyan\_converter.py](https://app.codecov.io/gh/simularium/simulariumio/pull/148?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c2ltdWxhcml1bWlvL21lZHlhbi9tZWR5YW5fY29udmVydGVyLnB5) | `98.02% <100.00%> (+0.01%)` | :arrow_up: | | [simulariumio/physicell/physicell\_converter.py](https://app.codecov.io/gh/simularium/simulariumio/pull/148?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c2ltdWxhcml1bWlvL3BoeXNpY2VsbC9waHlzaWNlbGxfY29udmVydGVyLnB5) | `97.81% <100.00%> (+0.09%)` | :arrow_up: | | [simulariumio/readdy/readdy\_converter.py](https://app.codecov.io/gh/simularium/simulariumio/pull/148?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c2ltdWxhcml1bWlvL3JlYWRkeS9yZWFkZHlfY29udmVydGVyLnB5) | `100.00% <100.00%> (ø)` | | | [simulariumio/smoldyn/smoldyn\_converter.py](https://app.codecov.io/gh/simularium/simulariumio/pull/148?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c2ltdWxhcml1bWlvL3Ntb2xkeW4vc21vbGR5bl9jb252ZXJ0ZXIucHk=) | `100.00% <100.00%> (ø)` | | | [simulariumio/springsalad/springsalad\_converter.py](https://app.codecov.io/gh/simularium/simulariumio/pull/148?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c2ltdWxhcml1bWlvL3NwcmluZ3NhbGFkL3NwcmluZ3NhbGFkX2NvbnZlcnRlci5weQ==) | `99.00% <100.00%> (+0.02%)` | :arrow_up: | | ... and [10 more](https://app.codecov.io/gh/simularium/simulariumio/pull/148?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | |

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