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

Include possibility to change input units #616

Open
grzanka opened this issue Jan 25, 2021 · 9 comments
Open

Include possibility to change input units #616

grzanka opened this issue Jan 25, 2021 · 9 comments

Comments

@grzanka
Copy link
Contributor

grzanka commented Jan 25, 2021

I.e. specify energy in MeV or in MeV/amu

@marwin1991
Copy link
Contributor

marwin1991 commented Jan 26, 2021

Something like that? A drop down list with units ?

image

@grzanka
Copy link
Contributor Author

grzanka commented Jan 26, 2021

Yes, exactly.
Some of the units are easy to convert (like MeV to GeV), but for some others knowledge of other input fields is needed.
For example to convert from MeV/u to MeV one needs to know particle type.

@marwin1991
Copy link
Contributor

marwin1991 commented Jan 26, 2021

So I see it lke that:

define available units with multiplier.

units: {
    "MeV": 1.0
    "GeV": 0.001
}

the first one is default one.

@marwin1991
Copy link
Contributor

But what about funtions where user can change particle ?

@grzanka
Copy link
Contributor Author

grzanka commented Jan 26, 2021

Let us consider https://libamtrack.github.io/web/#Particlerangeandstoppingpower/Stoppingpowervsenergy
First of all there is a basic reference unit for energy: MeV/u - the one which is expected by AT_Stopping_Power_with_no function
(https://github.com/libamtrack/web/blob/master/src/functionsFromC/AT_Mass_Stopping_Power_with_no.js)

Right now we specify energy in MeV/u.
The problem is that users are used to specify energy for protons in MeV, while for other ions in MeV/u.

Ideally user should define energy start and stop numerical values, then set the unit (MeV or MeV/u). Then user selects particle (proton or other particle). Finally when user clicks "Submit" all values are recalculated to basic reference unit (here MeV/u).

For plotting and output we should stay for now with fixed unit.

We could add a dictionary like you mention, but they should include not only multipliers, but also "converter functions". The tricky part is how to pass also their parameters.

@marwin1991
Copy link
Contributor

Maybe let's consider some example:

https://libamtrack.github.io/web/#Particlerangeandstoppingpower/Stoppingpowervsenergy

User defines start/end Energy in MeV: start 1.0 end 500.0, then picks "He" from particles, and for further calculations we have to find out MeV/u. And it would be start: 1.0/4.0026 and end 500.0/4.0026 (4,0026 is a "He" weight? )

The second thing is a question: should we change user input after submit ? Maybe it would be better to display converted values in some table, because user will have to remeber that he inserted 500.0 and recalculated value is 124,918 MeV/u and the next end value he want 600 MeV so he have to change units and if he forgets the calculations will be performed for 600MeV/u and results will be really confusing

@grzanka
Copy link
Contributor Author

grzanka commented Jan 28, 2021

@marwin1991 good point. Information what kind of units were used should not be lost.
I could imagine also another solution.

First a remark - user will probably need no more than 3-4 different units (most often only 2 be used).

By default only main unit is presented to the user. But there is small "Show more units button" somewhere.
If this is clicked few more columns appear (next to start/stop fields or others with units). Each column correspond to different unit. Description of field should be compressed and go over the field or be closer to the input field. If users enter a number in one field, automatically other fields in same row are being recalculated. The field with entered number is being highlighted in green, other (recalculated) fields are highlighted in red.
This should be similar to what is done in webinterface to Catima: https://isotopea.com/webatima/#!/projectile (try fillling beta or energy values).

The tricky part is when user is changing projectile. Then I'd keep fixed the value which was changed as last (green fields). Other fields would need to be recalculated.

It seems that the logic behind would need to be somehow complex.

@marwin1991
Copy link
Contributor

1. Something like that?

image

And chaning particle will recalculate MeV/u ?

2. I am also thinking about proposition #616 (comment)
and additionaly add something like validation inforamiton but green

image

and it would be displaying conversion to default value.

F.e. Stopping power has default MeV/u. User picks from dropdown MeV and inputs 1000 and below green validation info apears and displays "It is: XXX.XXX MeV/u" Then user picks diffrent particle and green validation now changes to "It is: YYYY.YYYY MeV/u"

@marwin1991
Copy link
Contributor

Maybe we should use https://docs.github.com/en/discussions/quickstart ?

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

No branches or pull requests

2 participants