Skip to content

Add option for 2nd x-axis in different units #49

@leek2

Description

@leek2

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:

  1. How do we declare we want this mode?
  2. How do we declare the "main" units? (This will determine the direction of the graph)
  3. How do we declare the sub units?
  4. How do we convert the sub units?
  5. 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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions