-
Notifications
You must be signed in to change notification settings - Fork 4
Add option for 2nd x-axis in different units #49
Description
Currently Curvallis has no notion of "units." The X and Y values are just numbers. However, if an EOS person (ie, Christine) is using Cuvallis, the X axis is nearly always in either denisty (g/cc) or Volume (cc/g or Angstrom^3/atom).
Density and volume are closely related, the CGS units for density is g/cc and for volume is cc/g. (It's just a reciprocal. It's slightly more complex if she wants volume to just be "cc" because you need to remove the grams)
Christine would like to be able to have 2 X-axes in different units. Maybe have volume at the bottom and density at the top. Like this example: https://matplotlib.org/3.1.0/gallery/subplots_axes_and_figures/secondary_axis.html
This poses some problems aside from the display issue:
- How do we declare we want this mode?
- How do we declare the "main" units? (This will determine the direction of the graph)
- How do we declare the sub units?
- How do we convert the sub units?
- If the volume is in cc/g, it's easy, it's just a reciprocal. But Christine suggested she might prefer angstrom^3/atom. In which case we need the atomic mass.
(If we wanted to be totally generic I guess we could add a units conversion module.)
But otherwise this is the conversion factor between cc/g and angstrom^3/atom
ATOMIC_VOLUME_TO_CGS = 0.602214179;
AMass = atomic mass
double convertAtomicVolume2CGS(const double AVolume) {
return AVolume * ( ATOMIC_VOLUME_TO_CGS / Amass);
}
double convertCGSVolume2Atomic(const double CGSVolume) {
return CGSVolume * (Amass() / ATOMIC_VOLUME_TO_CGS);
}