Class: Labimotion::Units

Inherits:
Object
  • Object
show all
Defined in:
lib/labimotion/utils/units.rb

Overview

Converter State

Constant Summary collapse

FIELDS =
[
{
  "type": "numeric",
  "field": "acceleration",
  "label": "Acceleration",
  "default": "",
  "position": 10,
  "placeholder": "acceleration",
  "units": [{ "key": "mm_s2", "label": "mm/s<sup>2</sup>" }]
},
{
  "type": "numeric",
  "field": "agitation",
  "label": "Agitation",
  "default": "",
  "position": 20,
  "placeholder": "agitation",
  "units": [{ "key": "rpm", "label": "rpm" }]
},
{
  "type": "numeric",
  "field": "amount_enzyme",
  "label": "Amount enzyme as μmol/min",
  "default": "",
  "position": 30,
  "placeholder": "amount enzyme as μmol/min",
  "units": [
    { "key": "u", "label": "U", "nm": 1 },
    { "key": "mu", "label": "mU", "nm": 1000 },
    { "key": "kat", "label": "kat", "nm": 1.667e-8 },
    { "key": "mkat", "label": "mkat", "nm": 1.667e-5 },
    { "key": "µkat", "label": "µkat", "nm": 0.01667 },
    { "key": "nkat", "label": "nkat", "nm": 16.67 }
  ]
},
{
  "type": "numeric",
  "field": "amount_substance",
  "label": "Amount of substance",
  "default": "",
  "position": 35,
  "placeholder": "amount of substance",
  "units": [
    { "key": "mol", "label": "mol", "nm": 1 },
    { "key": "mmol", "label": "mmol", "nm": 1000 },
    { "key": "umol", "label": "µmol", "nm": 1000000 },
    { "key": "nmol", "label": "nmol", "nm": 1.0e9 },
    { "key": "pmol", "label": "pmol", "nm": 1.0e12 }
  ]
},
{
  "type": "numeric",
  "field": "areal_density",
  "label": "Areal density",
  "default": "",
  "position": 38,
  "placeholder": "areal density",
  "units": [
    { "key": "kg_m2", "label": "kg m<sup>-2</sup>", "nm": 1 },
    { "key": "t_m2", "label": "t m<sup>-2</sup>", "nm": 0.001 },
    { "key": "kg_cm2", "label": "kg cm<sup>-2</sup>", "nm": 1e-4 },
    { "key": "g_m2", "label": "g m<sup>-2</sup>", "nm": 1000 }
  ]
},
{
  "type": "numeric",
  "field": "molarity",
  "label": "Chem. concentration (Molarity)",
  "default": "",
  "position": 40,
  "placeholder": "molarity",
  "units": [
    { "key": "mol_l", "label": "mol/L", "nm": 1 },
    { "key": "mmol_l", "label": "mmol/L", "nm": 1000 },
    { "key": "umol_l", "label": "µmol/L", "nm": 1000000 },
    { "key": "nmol_l", "label": "nmol/L", "nm": 1000000000 },
    { "key": "pmol_l", "label": "pmol/L", "nm": 1000000000000 }
  ]
},
{
  "type": "numeric",
  "field": "chem_distances",
  "label": "Chem. distances",
  "default": "",
  "position": 50,
  "placeholder": "Chem. distances",
  "units": [{ "key": "angstrom", "label": "Å" }]
},
{
  "type": "numeric",
  "field": "concentration",
  "label": "Concentration",
  "default": "",
  "position": 60,
  "placeholder": "concentration",
  "units": [
    { "key": "ng_l", "label": "ng/L", "nm": 1000000 },
    { "key": "mg_l", "label": "mg/L", "nm": 1000 },
    { "key": "g_l", "label": "g/L", "nm": 1 }
  ]
},
{
  "type": "numeric",
  "field": "conductivity",
  "label": "Conductivity",
  "default": "",
  "position": 62,
  "placeholder": "conductivity",
  "units": [
    { "key": "s_m", "label": "S/m", "nm": 1 },
    { "key": "ms_cm", "label": "mS/cm", "nm": 10 }
  ]
},
{
  "type": "numeric",
  "field": "currency",
  "label": "Currency",
  "default": "",
  "position": 64,
  "placeholder": "Currency",
  "units": [
    { "key": "eur", "label": "EUR", "nm": 1, "unit_type": "eur" },
    { "key": "chf", "label": "CHF", "nm": 1, "unit_type": "chf" },
    { "key": "gbp", "label": "GBP", "nm": 1, "unit_type": "gbp" },
    { "key": "usd", "label": "USD", "nm": 1, "unit_type": "usd" },
    { "key": "jpy", "label": "JPY", "nm": 1, "unit_type": "jpy" }
  ]
},
{
  "type": "numeric",
  "field": "current",
  "label": "Current",
  "default": "",
  "position": 67,
  "placeholder": "Current",
  "units": [
    { "key": "A", "label": "A", "nm": 1 },
    { "key": "mA", "label": "mA", "nm": 1000 },
    { "key": "uA", "label": "µA", "nm": 1000000 },
    { "key": "nA", "label": "nA", "nm": 1000000000 }
  ]
},
{
  "type": "numeric",
  "field": "c_rate",
  "label": "C-rate",
  "default": "",
  "position": 69,
  "placeholder": "C-rate",
  "units": [
    { "key": "c_h", "label": "1/h", "nm": 1 }
  ]
},
{
  "type": "numeric",
  "field": "degree",
  "label": "Degree",
  "default": "",
  "position": 70,
  "placeholder": "degree",
  "units": [{ "key": "degree", "label": "°" }]
},
{
  "type": "numeric",
  "field": "density",
  "label": "Density",
  "default": "",
  "position": 75,
  "placeholder": "density",
  "units": [
    { "key": "g_cm3", "label": "g/cm<sup>3</sup>", "nm": 1 },
    { "key": "kg_l", "label": "kg/l", "nm": 1 }
  ]
},
{
  "type": "numeric",
  "field": "dimensionless_concentration",
  "label": "Dimensionless concentration",
  "default": "",
  "position": 79,
  "placeholder": "dimensionless concentration",
  "units": [
    { "key": "ppm", "label": "ppm", "nm": 1 },
    { "key": "ppb", "label": "ppb", "nm": 1000 }
  ]
},
{
  "type": "numeric",
  "field": "duration",
  "label": "Duration",
  "default": "",
  "position": 80,
  "placeholder": "duration",
  "units": [
    { "key": "d", "label": "d", "nm": 1 },
    { "key": "h", "label": "h", "nm": 24 },
    { "key": "min", "label": "m", "nm": 1440 },
    { "key": "s", "label": "s", "nm": 86400 }
  ]
},
{
  "type": "numeric",
  "field": "elastic_modulus",
  "label": "Elastic modulus",
  "default": "",
  "position": 81,
  "placeholder": "Elastic modulus",
  "units": [
    { "key": "m_pa", "label": "MPa", "nm": 1 },
    { "key": "k_pa", "label": "kPa", "nm": 1000 },
    { "key": "pa", "label": "Pa", "nm": 1000000 }
  ]
},
{
  "type": "numeric",
  "field": "electric_charge_c",
  "label": "Electric Charge in C",
  "default": "",
  "position": 82,
  "placeholder": "Electric Charge in C",
  "units": [{ "key": "ec_c", "label": "C", "nm": 1 }]
},
{
  "type": "numeric",
  "field": "electric_charge_mol",
  "label": "Electric Charge per mol",
  "default": "",
  "position": 83,
  "placeholder": "Electric Charge per mol",
  "units": [{ "key": "ec_mol", "label": "C/mol", "nm": 1 }]
},
{
  "type": "numeric",
  "field": "electric_field",
  "label": "Electric field",
  "default": "",
  "position": 84,
  "placeholder": "Electric field",
  "units": [{ "key": "v_m", "label": "V/m", "nm": 1 }]
},
{
  "type": "numeric",
  "field": "electrical_capacity",
  "label": "Electrical capacity",
  "default": "",
  "position": 85,
  "placeholder": "Electrical capacity",
  "units": [
    { "key": "mah", "label": "mAh", "nm": 1000 },
    { "key": "ah", "label": "Ah", "nm": 1 },
    { "key": "as", "label": "As", "nm": 3600 },
    { "key": "c", "label": "C", "nm": 3600 }
  ]
},
{
  "type": "numeric",
  "field": "electrical_potential",
  "label": "Electrical potential",
  "default": "",
  "position": 86,
  "placeholder": "electrical potential",
  "units": [
    { "key": "v_re", "label": "V vs. RE", "nm": 1, "unit_type": "re" },
    { "key": "mv_re", "label": "mV vs. RE", "nm": 1000, "unit_type": "re" },
    { "key": "mv_ce", "label": "mV vs. CE", "nm": 1000, "unit_type": "ce" },
    { "key": "v_ce", "label": "V vs. CE", "nm": 1, "unit_type": "ce" }
  ]
},
{
  "type": "numeric",
  "field": "energy",
  "label": "Energy",
  "default": "",
  "position": 88,
  "placeholder": "Joule",
  "units": [
    { "key": "eV", "label": "eV", "nm": 6.241509e21 },
    { "key": "keV", "label": "keV", "nm": 6.241509e18 },
    { "key": "j", "label": "J", "nm": 1000 },
    { "key": "k_j", "label": "kJ", "nm": 1 }
  ]
},
{
  "type": "numeric",
  "field": "free_energy",
  "label": "Free Energy/enthalpy",
  "default": "",
  "position": 89,
  "placeholder": "Free Energy/enthalpy",
  "units": [
    { "key": "kj_mol", "label": "kJ/mol", "nm": 1 }
  ]
},
{
  "type": "numeric",
  "field": "enzyme_activity",
  "label": "Enzyme activity",
  "default": "",
  "position": 90,
  "placeholder": "Enzyme activity",
  "units": [
    { "key": "u_l", "label": "U/L", "nm": 1 },
    { "key": "u_ml", "label": "U/mL", "nm": 1e-3 },
    { "key": "u_g", "label": "U/g", "nm": 1e-3 },
    { "key": "u_mg", "label": "U/mg", "nm": 1e-6 }
  ]
},
{
  "type": "numeric",
  "field": "faraday",
  "label": "Faraday (Fd)",
  "default": "",
  "position": 95,
  "placeholder": "Faraday (Fd)",
  "units": [
    { "key": "faraday", "label": "Fd", "nm": 1 }
  ]
},
{
  "type": "numeric",
  "field": "flow_rate",
  "label": "Flow rate",
  "default": "",
  "position": 100,
  "placeholder": "Flow rate",
  "units": [
    { "key": "l_m", "label": "L/min", "nm": 1 },
    { "key": "ml_min", "label": "mL/min", "nm": 1000 },
    { "key": "ul_min", "label": "µL/min", "nm": 1000000 },
    { "key": "ml_h", "label": "mL/h", "nm": 60000 }
  ]
},
{
  "type": "numeric",
  "field": "frequency",
  "label": "Frequency",
  "default": "",
  "position": 103,
  "placeholder": "frequency",
  "units": [
    { "key": "hz", "label": "Hz", "nm": 1 },
    { "key": "khz", "label": "kHz", "nm": 1e-3 },
    { "key": "mhz", "label": "MHz", "nm": 1e-6 }
  ]
},
{
  "type": "numeric",
  "field": "heating_rate",
  "label": "Heating rate (Temperature ramp)",
  "default": "",
  "position": 106,
  "placeholder": "heating rate",
  "units": [
    { "key": "k_min", "label": "K/min", "nm": 1 },
    { "key": "k_s", "label": "K/s", "nm": 0.016666666666667 },
    { "key": "k_h", "label": "K/h", "nm": 60 },
    { "key": "degc_min", "label": "°C min<sup>-1</sup>", "nm": 1 },
    { "key": "degc_s", "label": "°C s<sup>-1</sup>", "nm": 0.016666666666667 },
    { "key": "degc_h", "label": "°C h<sup>-1</sup>", "nm": 60 }
  ]
},
{
  "type": "numeric",
  "field": "length",
  "label": "Length",
  "default": "",
  "position": 110,
  "placeholder": "length",
  "units": [
    { "key": "mm", "label": "mm", "nm": 1000 },
    { "key": "cm", "label": "cm", "nm": 100 },
    { "key": "m", "label": "m", "nm": 1 }
  ]
},
{
  "type": "numeric",
  "field": "magnetic_flux_density",
  "label": "Magnetic flux density/inductivity",
  "default": "",
  "position": 120,
  "placeholder": "",
  "units": [{ "key": "T", "label": "T", "nm": 1 }]
},
{
  "type": "numeric",
  "field": "mass",
  "label": "Mass",
  "default": "",
  "position": 120,
  "placeholder": "mass",
  "units": [
    { "key": "g", "label": "g", "nm": 1 },
    { "key": "mg", "label": "mg", "nm": 1000 },
    { "key": "ug", "label": "µg", "nm": 1000000 }
  ]
},
{
  "type": "numeric",
  "field": "mass_fraction",
  "label": "Mass fraction",
  "default": "",
  "position": 123,
  "placeholder": "mass fraction",
  "units": [
    { "key": "wt_p", "label": "wt.%", "nm": 1 }
  ]
},
{
  "type": "numeric",
  "field": "mass_loading",
  "label": "Mass loading",
  "default": "",
  "position": 125,
  "placeholder": "mass loading",
  "units": [
    { "key": "g_cm2", "label": "g cm<sup>-2</sup>", "nm": 1 },
    { "key": "mg_cm2", "label": "mg cm<sup>-2</sup>", "nm": 1000 }
  ]
},
{
  "type": "numeric",
  "field": "mass_molecule",
  "label": "Mass of molecule",
  "default": "",
  "position": 126,
  "placeholder": "mass of molecule",
  "units": [
    { "key": "dalton", "label": "D", "nm": 1000 },
    { "key": "kilo_dalton", "label": "kD", "nm": 1 }
  ]
},
{
  "type": "numeric",
  "field": "molar_conductivity",
  "label": "Molar conductivity",
  "default": "",
  "position": 127,
  "placeholder": "molar conductivity",
  "units": [
    { "key": "s_cm2_mol", "label": "S cm<sup>2</sup> mol<sup>-1</sup>", "nm": 1 }
  ]
},
{
  "type": "numeric",
  "field": "molar_entropy",
  "label": "Molar Entropy",
  "default": "",
  "position": 128,
  "placeholder": "Molar Entropy",
  "units": [
    { "key": "j_mol_k", "label": "J/(mol*K)", "nm": 1 }
  ]
},
{
  "type": "numeric",
  "field": "molecular_weight",
  "label": "Molecular weight",
  "default": "",
  "position": 130,
  "placeholder": "Molecular weight",
  "units": [{ "key": "g_mol", "label": "g/mol" }]
},
{
  "type": "numeric",
  "field": "percentage",
  "label": "Percentage",
  "default": "",
  "position": 136,
  "placeholder": "percentage",
  "units": [{ "key": "p", "label": "%", "nm": 1 }]
},
{
  "type": "numeric",
  "field": "power",
  "label": "Power",
  "default": "",
  "position": 137,
  "placeholder": "power",
  "units": [{ "key": "watt", "label": "W", "nm": 1 }]
},
{
  "type": "numeric",
  "field": "pressure",
  "label": "Pressure",
  "default": "",
  "position": 140,
  "placeholder": "pressure",
  "units": [
    { "key": "atm", "label": "atm", "nm": 1 },
    { "key": "pa", "label": "Pa", "nm": 101325 },
    { "key": "kpa", "label": "kPa", "nm": 101.325 },
    { "key": "hpa", "label": "hPa", "nm": 1013.25 },
    { "key": "torr", "label": "Torr", "nm": 760 },
    { "key": "bar", "label": "bar", "nm": 1.01325 },
    { "key": "mbar", "label": "mbar", "nm": 1013.25 }
  ]
},
{
  "type": "numeric",
  "field": "process_rate",
  "label": "Process rate",
  "default": "",
  "position": 143,
  "placeholder": "Process rate",
  "units": [
    { "key": "1_s", "label": "1/s", "nm": 1 },
    { "key": "1_min", "label": "1/min", "nm": 60 },
    { "key": "1_h", "label": "1/h", "nm": 3600 }
  ]
},
{
  "type": "numeric",
  "field": "rate_constant",
  "label": "Rate constant",
  "default": "",
  "position": 146,
  "placeholder": "Rate constant",
  "units": [
    { "key": "1_m_s", "label": "1/(M*s)", "nm": 1 }
  ]
},
{
  "type": "numeric",
  "field": "reaction_rate",
  "label": "Reaction rate",
  "default": "",
  "position": 150,
  "placeholder": "Reaction rate",
  "units": [
    { "key": "mol_lmin", "label": "mol L<sup>-1</sup> min<sup>-1</sup>", "nm": 1 },
    { "key": "mol_lsec", "label": "mol L<sup>-1</sup> s<sup>-1</sup>", "nm": 0.016666666666667 }
  ]
},
{
  "type": "numeric",
  "field": "resolution",
  "label": "Resolution",
  "default": "",
  "position": 152,
  "placeholder": "Resolution",
  "units": [
    { "key": "px", "label": "px", "nm": 1 },
    { "key": "mp", "label": "MP", "nm": 1e-6 }
  ]
},
{
  "type": "numeric",
  "field": "scan_rate",
  "label": "Scan rate",
  "default": "",
  "position": 155,
  "placeholder": "Scan rate",
  "units": [
    { "key": "mv_s", "label": "mV/s", "nm": 1000 },
    { "key": "v_s", "label": "V/s", "nm": 1 }
  ]
},
{
  "type": "numeric",
  "field": "specific_current",
  "label": "Specific current",
  "default": "",
  "position": 156,
  "placeholder": "Specific current",
  "units": [
    { "key": "ma_g", "label": "mA/g", "nm": 1000, "unit_type": "mass" },
    { "key": "a_g", "label": "A/g", "nm": 1, "unit_type": "mass" },
    { "key": "ma_cm2", "label": "mA/cm<sup>2</sup>", "nm": 1000, "unit_type": "area" },
    { "key": "a_cm2", "label": "A/cm<sup>2</sup>", "nm": 1, "unit_type": "area" },
    { "key": "a_mm2", "label": "A/mm<sup>2</sup>", "nm": 0.01, "unit_type": "area" }
  ]
},
{
  "type": "numeric",
  "field": "specific_electrical_capacity",
  "label": "Specific electrical capacity",
  "default": "",
  "position": 157,
  "placeholder": "Specific electrical capacity",
  "units": [
    { "key": "mah_g", "label": "mAh/g", "nm": 1000 },
    { "key": "ah_g", "label": "Ah/g", "nm": 1 }
  ]
},
{
  "type": "numeric",
  "field": "specific_surface_area",
  "label": "Specific surface area",
  "default": "",
  "position": 158,
  "placeholder": "Specific surface area",
  "units": [
    { "key": "m2_g", "label": "m<sup>2</sup>/g", "nm": 1 }
  ]
},
{
  "type": "numeric",
  "field": "specific_volume",
  "label": "Specific Volume",
  "default": "",
  "position": 160,
  "placeholder": "Specific Volume",
  "units": [{ "key": "cm3_g", "label": "cm<sup>3</sup>/g", "nm": 1 }]
},
{
  "type": "numeric",
  "field": "speed",
  "label": "Speed",
  "default": "",
  "position": 165,
  "placeholder": "speed",
  "units": [
    { "key": "cm_s", "label": "cm/s", "nm": 1 },
    { "key": "mm_s", "label": "mm/s", "nm": 10 },
    { "key": "um_m", "label": "µm/min", "nm": 600000 },
    { "key": "nm_m", "label": "nm/min", "nm": 600000000 },
    { "key": "cm_h", "label": "cm/h", "nm": 3600 },
    { "key": "mm_h", "label": "mm/h", "nm": 36000 }
  ]
},
{
  "type": "numeric",
  "field": "subatomic_length",
  "label": "Subatomic length",
  "default": "",
  "position": 168,
  "placeholder": "Subatomic length",
  "units": [
    { "key": "um", "label": "µm", "nm": 1 },
    { "key": "nm", "label": "nm", "nm": 1000 },
    { "key": "pm", "label": "pm", "nm": 1000000 }
  ]
},
{
  "type": "numeric",
  "field": "surface",
  "label": "Surface",
  "default": "",
  "position": 170,
  "placeholder": "surface",
  "units": [
    { "key": "a_2", "label": "A<sup>2</sup>", "nm": 1.0e16 },
    { "key": "um_2", "label": "µm<sup>2</sup>", "nm": 1.0e8 },
    { "key": "mm_2", "label": "mm<sup>2</sup>", "nm": 100 },
    { "key": "cm_2", "label": "cm<sup>2</sup>", "nm": 1 }
  ]
},
{
  "type": "numeric",
  "field": "temperature",
  "label": "Temperature",
  "default": "",
  "position": 180,
  "placeholder": "temperature",
  "units": [
    { "key": "C", "label": "°C" },
    { "key": "F", "label": "°F" },
    { "key": "K", "label": "K" }
  ]
},
{
  "type": "numeric",
  "field": "tensile_force",
  "label": "Tensile force",
  "default": "",
  "position": 185,
  "placeholder": "tensile force",
  "units": [
    { "key": "n", "label": "N", "nm": 1 },
    { "key": "kn", "label": "kN", "nm": 0.001 },
    { "key": "mn", "label": "mN", "nm": 1000 }
  ]
},
{
  "type": "numeric",
  "field": "tensile_stress",
  "label": "Tensile stress",
  "default": "",
  "position": 186,
  "placeholder": "tensile stress",
  "units": [
    { "key": "n_cm2", "label": "N cm<sup>-2</sup>", "nm": 1 },
    { "key": "n_mm2", "label": "N mm<sup>-2</sup>", "nm": 0.01 }
  ]
},
{
  "type": "numeric",
  "field": "turnover_number",
  "label": "Turnover number",
  "default": "",
  "position": 190,
  "placeholder": "Turnover number",
  "units": [{ "key": "1_s", "label": "1/s", "nm": 1 }, { "key": "1_m", "label": "1/m", "nm": 60 }]
},
{
  "type": "numeric",
  "field": "viscosity",
  "label": "Dynamic Viscosity",
  "default": "",
  "position": 200,
  "placeholder": "Dynamic Viscosity",
  "units": [
    { "key": "pas", "label": "Pas", "nm": 1 },
    { "key": "mpas", "label": "mPas", "nm": 1000 }
  ]
},
{
  "type": "numeric",
  "field": "kinematic_viscosity",
  "label": "Kinematic Viscosity",
  "default": "",
  "position": 205,
  "placeholder": "Kinematic Viscosity",
  "units": [{ "key": "m2_s", "label": "m<sup>2</sup>/s", "nm": 1 }]
},
{
  "type": "numeric",
  "field": "voltage",
  "label": "Voltage",
  "default": "",
  "position": 206,
  "placeholder": "voltage",
  "units": [
    { "key": "mv", "label": "mV", "nm": 1000 },
    { "key": "v", "label": "V", "nm": 1 },
    { "key": "kv", "label": "kV", "nm": 0.001 }
  ]
},
{
  "type": "numeric",
  "field": "volumes",
  "label": "Volumes (Litre-based)",
  "default": "",
  "position": 210,
  "placeholder": "volume",
  "units": [
    { "key": "l", "label": "l", "nm": 1 },
    { "key": "ml", "label": "ml", "nm": 1000 },
    { "key": "ul", "label": "µl", "nm": 1000000 },
    { "key": "nl", "label": "nl", "nm": 1000000000 }
  ]
},
{
  "type": "numeric",
  "field": "volume_fraction",
  "label": "Volume fraction",
  "default": "",
  "position": 218,
  "placeholder": "volume fraction",
  "units": [
    { "key": "vol_p", "label": "vol.%", "nm": 1 }
  ]
},
{
  "type": "numeric",
  "field": "volumes_metric",
  "label": "Volumes (Metric-based)",
  "default": "",
  "position": 220,
  "placeholder": "volume",
  "units": [
    { "key": "cm3", "label": "cm³", "nm": 1 },
    { "key": "mm3", "label": "mm³", "nm": 1000 },
    { "key": "m3", "label": "", "nm": 0.000001 }
  ]
}
]