From 355bd87a62ac7c4c712ee8bc8a7695b2d3738d03 Mon Sep 17 00:00:00 2001 From: Ben Elkin <8xe8n-cm@online.de> Date: Sun, 24 Dec 2023 21:31:14 +0100 Subject: [PATCH 01/13] make docs chapter default units & phys. constants --- docs/make.jl | 28 +++- docs/make_def-units_docs.jl | 322 ++++++++++++++++++++++++++++++++++++ 2 files changed, 348 insertions(+), 2 deletions(-) create mode 100644 docs/make_def-units_docs.jl diff --git a/docs/make.jl b/docs/make.jl index e8f865d3..c76dea89 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,10 +1,30 @@ using Documenter, Unitful, Dates +const ci = get(ENV, "CI", nothing) == "true" + +function check_defaultunits_version() + vfile = "docs/src/assets/vfile.txt" + r = readline(vfile) + docs_v = VersionNumber(r) + pkg_v = pkgversion(Unitful) + docs_v == pkg_v || error("Docs chapter on default units built with the wrong version of Unitful \ + (docs built for $docs_v vs current Unitful version $pkg_v). \ + Please run the script on the local computer with the proper Unitful version") + return nothing +end + +# on local computer, (re-)create the documentation file defaultunits.md +if !ci + ENV["UNITFUL_FANCY_EXPONENTS"] = false + include("make_def-units_docs.jl") + MakeDefUnitsDocs.make_chapter() +end + DocMeta.setdocmeta!(Unitful, :DocTestSetup, :(using Unitful)) makedocs( sitename = "Unitful.jl", - format = Documenter.HTML(prettyurls = get(ENV, "CI", nothing) == "true"), + format = Documenter.HTML(prettyurls = ci), warnonly = [:missing_docs], modules = [Unitful], workdir = joinpath(@__DIR__, ".."), @@ -21,8 +41,12 @@ makedocs( "Interoperability with `Dates`" => "dates.md" "Extending Unitful" => "extending.md" "Troubleshooting" => "trouble.md" + "Pre-defined units and constants" => "defaultunits.md" "License" => "LICENSE.md" ] ) -deploydocs(repo = "github.com/PainterQubits/Unitful.jl.git") +if ci + check_defaultunits_version() + deploydocs(repo = "github.com/PainterQubits/Unitful.jl.git") +end diff --git a/docs/make_def-units_docs.jl b/docs/make_def-units_docs.jl new file mode 100644 index 00000000..da6f9b87 --- /dev/null +++ b/docs/make_def-units_docs.jl @@ -0,0 +1,322 @@ +module MakeDefUnitsDocs + +using Unitful, OrderedCollections + +mdfile = "docs/src/defaultunits.md" +mdheader = "docs/src/assets/defaultunits-header.md" +# mdfooter = "docs/src/assets/defaultunits-footer.md" +mdlogunits = "docs/src/assets/defaultunits-logunits.md" +vfile = "docs/src/assets/vfile.txt" + +""" +# Examples +```julia-repl +julia> prefnamesvals() +OrderedCollections.OrderedDict{String, Tuple{String, Int64}} with 20 entries: + "y" => ("yocto", -24) + "z" => ("zepto", -21) + ⋮ => ⋮ +""" +function prefnamesvals() + prefixnamestable = [ + ("quetta" , "Q" , 1E+030 ) , + ("ronna" , "R" , 1E+027 ) , + ("yotta" , "Y" , 1E+024 ) , + ("zetta" , "Z" , 1E+021 ) , + ("exa" , "E" , 1E+018 ) , + ("peta" , "P" , 1000000000000000 ) , + ("tera" , "T" , 1000000000000 ) , + ("giga" , "G" , 1000000000 ) , + ("mega" , "M" , 1000000 ) , + ("kilo" , "k" , 1000 ) , + ("hecto" , "h" , 100 ) , + ("deca" , "da" , 10 ) , + ("deci" , "d" , 0.1 ) , + ("centi" , "c" , 0.01 ) , + ("milli" , "m" , 0.001 ) , + ("micro" , "μ" , 0.000001 ) , + ("nano" , "n" , 0.000000001 ) , + ("pico" , "p" , 1E-12 ) , + ("femto" , "f" , 1E-15 ) , + ("atto" , "a" , 1E-18 ) , + ("zepto" , "z" , 1E-21 ) , + ("yocto" , "y" , 1E-24 ) , + ("ronto" , "r" , 1E-27 ) , + ] + pd = Unitful.prefixdict + sxp = sort(collect(keys(pd))) + + pnn = Dict([p[2] => p[1] for p in prefixnamestable]) + pnv = Dict([p[2] => p[3] for p in prefixnamestable]) + + @assert all([log10(pnv[v]) == k for (k, v) in pd if pd[k] != ""]) + return OrderedDict([pd[k] => (pnn[pd[k]], k) for k in sxp if pd[k] != ""]) +end + +regularid(n) = ! startswith(string(n), r"#|@") + +uful_ids() = [n for n in names(Unitful; all=true) if regularid(n)] + +docstr(n::Symbol) = Base.Docs.doc(Base.Docs.Binding(Unitful, n)) |> string + +isprefixed(u::Symbol) = occursin("A prefixed unit, equal", docstr(u)) + +isdocumented(n::Symbol) = ! startswith(docstr(n), "No documentation found.") + +""" +# Examples +```julia-repl +julia> gettypes(Unitful.Power) +1-element Vector{DataType}: + Quantity{T, 𝐋^2 𝐌 𝐓^-3, U} +``` +""" +function gettypes(x::Type) + if x isa UnionAll + return gettypes(x.body) + elseif x isa Union + pns = propertynames(x) + ts = [getproperty(x, pn) for pn in pns] + ts = [t for t in ts if (t isa Type) && (t <: Unitful.Quantity)] + return ts + elseif x <: Unitful.Quantity + return [x] + else + return [] + end +end + + +""" + getphysdims(uids::Vector{Symbol}) +Filters the list of `Unitful` identifiers to return those which denote physical dimensions (e.g. `Area`, `Power`) +""" +getphysdims(uids) = [n for n in uids + if (getproperty(Unitful, n) isa UnionAll) && + ! endswith(string(n), "Units") && + ! occursin("Scale", string(n)) && + !isempty(gettypes(getproperty(Unitful, n)))] + +""" +# Examples +```julia-repl +julia> getdim(Unitful.Area) +𝐋^2 +``` +""" +getdim(x::Type) = gettypes(x)[1].parameters[2] +getdim(x::Symbol) = getdim(getproperty(Unitful, x)) + +""" +# Examples +```julia-repl +julia> getdimpars(Unitful.Power) +svec((Unitful.Dimension{:Length}(2//1), Unitful.Dimension{:Mass}(1//1), Unitful.Dimension{:Time}(-3//1))) +``` +""" +getdimpars(x) = getproperty(typeof(getdim(x)), :parameters) +getdimpar(x) = getdimpars(x)[1][1] +getdimpow(x) = getdimpar(x).power + +isbasicdim(x) = length(getdimpars(x)[1])== 1 && getdimpow(x) == 1 + +function physdims_categories(physdims) + basicdims = Symbol[] + compounddims = Symbol[] + otherdims = Symbol[] + for d in physdims + try + if isbasicdim(d) + push!(basicdims, d) + else + push!(compounddims, d) + end + catch + push!(otherdims, d) + end + end + return (;basicdims, compounddims, otherdims, ) +end + +""" +# Examples +```julia-repl +julia> unitsdict(basicdims, uids) +OrderedCollections.OrderedDict{Symbol, Vector{Symbol}} with 7 entries: + :Amount => [:mol] + :Current => [:A] + :Length => [:angstrom, :ft, :inch, :m, :mi, :mil, :yd] + :Luminosity => [:cd, :lm] + :Mass => [:dr, :g, :gr, :kg, :lb, :oz, :slug, :u] + :Temperature => [:K, :Ra, :°C, :°F] + :Time => [:d, :hr, :minute, :s, :wk, :yr] +``` +""" +function unitsdict(physdims, uids) + ups = [] + for d in physdims + dm = getproperty(Unitful, d) + units = Symbol[] + for uname in uids + u = getproperty(Unitful, uname) + if (u isa Unitful.Units) + if (1*u isa dm) && (!isprefixed(uname) || uname == :g) && isdocumented(uname) # gram considered prefixed unit + push!(units, uname) + end + end + end + if !isempty(units) + sort!(units; by = x -> lowercase(string(x))) + unique!(nameofunit, units) # special cases: Liter, Angstrom + push!(ups, d => units) + end + end + return OrderedDict(sort!(ups)) +end + +function physconstants(uids) + ph_consts = [n for n in uids if + isconst(Unitful, n) && + !(getproperty(Unitful, n) isa Union{Type, Unitful.Units, Unitful.Dimensions, Module, Function}) && + isdocumented(n) ] + sort!(ph_consts) + return ph_consts +end + +function isnodims(u) + u isa Unitful.FreeUnits || return false + return getproperty(typeof(u), :parameters)[2] == NoDims +end +isnodims(u::Symbol) = isnodims(getproperty(Unitful, u)) + +nodimsunits(uids) = [n for n in uids if isnodims(n) && isdocumented(n) && !isprefixed(n) && n != :NoUnits] + +removerefs(d) = replace(d, r"\[(`[\w\.]+\`)]\(@ref\)" => s"\1") + +""" + udoc(s) +Truncates documentation and removes references +""" +udoc(s) = match(r"(?ms)(.+)\n\nDimension: ", docstr(s)).captures[1] |> removerefs + +function nameofunit(u) + special = Dict(u"ha" => "Hectare", u"kg" => "Kilogram", u"°F" => "Degree Fahrenheit", u"°C" => "Degree Celcius") + u in keys(special) && return special[u] + t = typeof(u) + ps = getproperty(t, :parameters) + u1 = ps[1][1] + @assert u1 isa Unitful.Unit + t1 = typeof(u1) + uname = getproperty(t1, :parameters)[1] + return string(uname) +end + +nameofunit(s::Symbol) = nameofunit(getproperty(Unitful, s)) + +function make_subsection_text(uvec; isunit=true) + s = "" + for u in uvec + if isunit + n = nameofunit(u) + else + n = string(u) + end + d = udoc(u) + s *= "#### $n \n\n$d \n\n" + end + return s +end + +function make_simple_section_text(sectiontitle, uvec; isunit=true) + s = "## $sectiontitle \n\n" + s *= make_subsection_text(uvec; isunit) + return s +end + +function make_structured_section_text(sectiontitle, sectiondict) + s = "## $sectiontitle \n\n" + for (dim, uvec) in sectiondict + s *= "### $dim\n\n" + s *= make_subsection_text(uvec) + end + return s +end + +function makeprefixsection(pnv) + s = """ +## Metric (SI) Prefixes + +| Prefix | Name | Power of Ten | +|--------|--------|--------| +""" + for (k,v) in pnv + s *= "| $k | $(v[1]) | $(v[2]) | \n" + end + + return s +end + + +header() = read(mdheader, String) +# footer() = read(mdfooter, String) +logunits() = read(mdlogunits, String) + +function makefulltext(sections, nodims_units, phys_consts) + s = header() * "\n\n" + for (sectiontitle, sectiondict) in sections + s *= make_structured_section_text(sectiontitle, sectiondict) + end + s *= make_simple_section_text("Dimensionless units", nodims_units) + s *= logunits() + s *= make_simple_section_text("Physical constants", phys_consts; isunit=false) + s *= makeprefixsection(prefnamesvals()) + # s *= footer() + return s +end + +function write_unitful_v(vfile) + open(vfile, "w") do io + println(io, pkgversion(Unitful)) + end + return nothing +end + +function savetext(fulltext, mdfile) + open(mdfile,"w") do io + write(io, fulltext) + end + write_unitful_v(vfile) + return nothing +end + +""" + make_chapter(wr = true; verbose = false) +Generates the text of the `Pre-defined units and constants` documentation section +and writes it into the file if `wr==true` +""" +function make_chapter(wr = true; verbose = false) + uids = uful_ids() + + (;basicdims, compounddims) = uids |> getphysdims |> physdims_categories + + basic_units = unitsdict(basicdims, uids) + compound_units = unitsdict(compounddims, uids) + nodims_units = nodimsunits(uids) + sections = OrderedDict(["Basic dimensions" => basic_units, + "Compound dimensions" => compound_units]) + phys_consts = physconstants(uids) + + fulltext = makefulltext(sections, nodims_units, phys_consts) + + wr && savetext(fulltext, mdfile) + + if verbose + return (;fulltext, sections, nodims_units, phys_consts) + else + return nothing + end +end + +export make_chapter + +end # module From fb264f38fd847cf5148d40ee4047b6dace160fff Mon Sep 17 00:00:00 2001 From: Ben Elkin <8xe8n-cm@online.de> Date: Sun, 24 Dec 2023 22:02:22 +0100 Subject: [PATCH 02/13] assets for default units --- docs/src/assets/defaultunits-footer.md | 1 + docs/src/assets/defaultunits-header.md | 16 ++++++++++++++++ docs/src/assets/defaultunits-logunits.md | 21 +++++++++++++++++++++ docs/src/assets/vfile.txt | 1 + 4 files changed, 39 insertions(+) create mode 100644 docs/src/assets/defaultunits-footer.md create mode 100644 docs/src/assets/defaultunits-header.md create mode 100644 docs/src/assets/defaultunits-logunits.md create mode 100644 docs/src/assets/vfile.txt diff --git a/docs/src/assets/defaultunits-footer.md b/docs/src/assets/defaultunits-footer.md new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/docs/src/assets/defaultunits-footer.md @@ -0,0 +1 @@ + diff --git a/docs/src/assets/defaultunits-header.md b/docs/src/assets/defaultunits-header.md new file mode 100644 index 00000000..36ac4987 --- /dev/null +++ b/docs/src/assets/defaultunits-header.md @@ -0,0 +1,16 @@ +# Units and сonstants pre-defined in the `Unitful` package + +In the following, only non-prefixed units are listed. To get a more detailed information about a unit, and to get information about prefixed units, use `Julia` help, e.g. + +``` +help?> Unitful.kW + Unitful.kW + + A prefixed unit, equal to 10^3 W. + + Dimension: 𝐋² 𝐌 𝐓⁻³ + + See also: Unitful.W. +``` + +For prefixes, see [below](#Metric-(SI)-Prefixes). diff --git a/docs/src/assets/defaultunits-logunits.md b/docs/src/assets/defaultunits-logunits.md new file mode 100644 index 00000000..78d5add3 --- /dev/null +++ b/docs/src/assets/defaultunits-logunits.md @@ -0,0 +1,21 @@ +## Logarithmic units + +| Unit | Name | +|----------------|---------------------------------| +| `dB` | Decibel | +| `B` | Bel | +| `Np` | Neper | +| `cNp` | Centineper | + +### "Dimensionful" logarithmic units +| Unit | Reference level | +|----------------|---------------------------------| +| `dBHz` | 1Hz | +| `dBm` | 1mW | +| `dBV` | 1V | +| `dBu` | sqrt(0.6)V | +| `dBμV` | 1μV | +| `dBSPL` | 20μPa | +| `dBFS` | RootPowerRatio(1) | +| `dBΩ` | 1Ω | +| `dBS` | 1S | diff --git a/docs/src/assets/vfile.txt b/docs/src/assets/vfile.txt new file mode 100644 index 00000000..815d5ca0 --- /dev/null +++ b/docs/src/assets/vfile.txt @@ -0,0 +1 @@ +1.19.0 From c450d4ea63075ec21d5d905543c38ea53e7215bf Mon Sep 17 00:00:00 2001 From: Ben Elkin <8xe8n-cm@online.de> Date: Sun, 24 Dec 2023 23:02:27 +0100 Subject: [PATCH 03/13] add defaultunits.md --- docs/src/defaultunits.md | 965 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 965 insertions(+) create mode 100644 docs/src/defaultunits.md diff --git a/docs/src/defaultunits.md b/docs/src/defaultunits.md new file mode 100644 index 00000000..259a3920 --- /dev/null +++ b/docs/src/defaultunits.md @@ -0,0 +1,965 @@ +# Units and сonstants pre-defined in the `Unitful` package + +In the following, only non-prefixed units are listed. To get a more detailed information about a unit, and to get information about prefixed units, use `Julia` help, e.g. + +``` +help?> Unitful.kW + Unitful.kW + + A prefixed unit, equal to 10^3 W. + + Dimension: 𝐋² 𝐌 𝐓⁻³ + + See also: Unitful.W. +``` + +For prefixes, see [below](#Metric-(SI)-Prefixes). + + +## Basic dimensions + +### Amount + +#### Mole + +``` +Unitful.mol +``` + +The mole, the SI base unit for amount of substance. + +### Current + +#### Ampere + +``` +Unitful.A +``` + +The ampere, the SI base unit of electric current. + +### Length + +#### Angstrom + +``` +Unitful.angstrom +Unitful.Å +``` + +The angstrom, a metric unit of length defined as 1/10 nm. + +#### Foot + +``` +Unitful.ft +``` + +The foot, a US customary unit of length defined as 12 inch. + +#### Inch + +``` +Unitful.inch +``` + +The inch, a US customary unit of length defined as 2.54 cm. + +#### Meter + +``` +Unitful.m +``` + +The meter, the SI base unit of length. + +#### Mile + +``` +Unitful.mi +``` + +The mile, a US customary unit of length defined as 1760 yd. + +#### Mil + +``` +Unitful.mil +``` + +The mil, a US customary unit of length defined as 1/1000 inch. + +#### Yard + +``` +Unitful.yd +``` + +The yard, a US customary unit of length defined as 3 ft. + +### Luminosity + +#### Candela + +``` +Unitful.cd +``` + +The candela, the SI base unit of luminous intensity. + +#### Lumen + +``` +Unitful.lm +``` + +The lumen, an SI unit of luminous flux, defined as 1 cd × sr. + +### Mass + +#### Dram + +``` +Unitful.dr +``` + +The dram, a US customary unit of mass defined as 1/16 oz. + +#### Gram + +``` +Unitful.g +``` + +A prefixed unit, equal to 10^-3 kg. Note that `kg`, not `g`, is the base unit. + +#### Grain + +``` +Unitful.gr +``` + +The grain, a US customary unit of mass defined as 1/7000 lb. + +#### Kilogram + +``` +Unitful.kg +``` + +The kilogram, the SI base unit of mass. Note that `kg`, not `g`, is the base unit. + +#### Pound + +``` +Unitful.lb +``` + +The pound-mass, a US customary unit of mass defined as exactly 0.453,592,37 kg. + +#### Ounce + +``` +Unitful.oz +``` + +The ounce, a US customary unit of mass defined as 1/16 lb. + +#### Slug + +``` +Unitful.slug +``` + +The slug, a US customary unit of mass defined as 1 lbf × s^2 / ft. + +#### UnifiedAtomicMassUnit + +``` +Unitful.u +``` + +The unified atomic mass unit, or dalton, a unit of mass defined as 1/12 the mass of an unbound neutral atom of carbon-12, equal to 1.660,539,066,60 × 10^-27 kg (the CODATA 2018 recommended value). + +### Temperature + +#### Kelvin + +``` +Unitful.K +``` + +The kelvin, the SI base unit of thermodynamic temperature. + +#### Rankine + +``` +Unitful.Ra +``` + +The rankine, a US customary unit of temperature defined as 5/9 K. + +#### Degree Celcius + +``` +Unitful.°C +``` + +The degree Celsius, an SI unit of temperature, defined such that 0 °C = 273.15 K. + +#### Degree Fahrenheit + +``` +Unitful.°F +``` + +The degree Fahrenheit, a US customary unit of temperature, defined such that 0 °F = 459.67 Ra. + +### Time + +#### Day + +``` +Unitful.d +``` + +The day, a unit of time defined as 24 hr. + +#### Hour + +``` +Unitful.hr +``` + +The hour, a unit of time defined as 60 minutes. + +#### Minute + +``` +Unitful.minute +``` + +The minute, a unit of time defined as 60 s. The full name `minute` is used instead of the symbol `min` to avoid confusion with the Julia function `min`. + +#### Second + +``` +Unitful.s +``` + +The second, the SI base unit of time. + +#### Week + +``` +Unitful.wk +``` + +The week, a unit of time, defined as 7 d. + +#### Year + +``` +Unitful.yr +``` + +The year, a unit of time, defined as 365.25 d. + +## Compound dimensions + +### Acceleration + +#### Gal + +``` +Unitful.Gal +``` + +The gal, a CGS unit of acceleration, defined as 1 cm / s^2. + +#### EarthGravity + +``` +Unitful.ge +``` + +The nominal acceleration due to gravity in a vacuum near the surface of the earth, a unit of acceleration, defined by standard to be exactly 9.806,65 m / s^2. + +`Unitful.gn` is a quantity (with units `m/s^2`) whereas `Unitful.ge` is a unit equal to `gn`. + +### Area + +#### Are + +``` +Unitful.a +``` + +The are, a metric unit of area, defined as 100 m^2. + +#### Acre + +``` +Unitful.ac +``` + +The acre, a US customary unit of area defined as 4840 yd^2. + +#### Barn + +``` +Unitful.b +``` + +The barn, a metric unit of area, defined as 100 fm^2. + +#### Hectare + +``` +Unitful.ha +``` + +The hectare, a metric unit of area, defined as 100 a. + +### BField + +#### Gauss + +``` +Unitful.Gauss +``` + +The gauss, a CGS unit of magnetic B-field strength, defined as 1 Mx / cm^2. + +#### Tesla + +``` +Unitful.T +``` + +The tesla, an SI unit of magnetic B-field strength, defined as 1 kg / (A × s^2). + +### Capacitance + +#### Farad + +``` +Unitful.F +``` + +The farad, an SI unit of electrical capacitance, defined as 1 s^4 × A^2 / (kg × m^2). + +### Charge + +#### Coulomb + +``` +Unitful.C +``` + +The coulomb, an SI unit of electric charge, defined as 1 A × s. + +### DynamicViscosity + +#### Poise + +``` +Unitful.P +``` + +The poise, a CGS unit of dynamic viscosity, defined as 1 dyn × s / cm^2. + +### ElectricalConductance + +#### Siemens + +``` +Unitful.S +``` + +The siemens, an SI unit of electrical conductance, defined as 1 Ω^-1. + +### ElectricalResistance + +#### Ohm + +``` +Unitful.Ω +``` + +The ohm, an SI unit of electrical resistance, defined as 1 V / A. + +### Energy + +#### BritishThermalUnit + +``` +Unitful.btu +``` + +The British thermal unit, a US customary unit of heat defined by ISO 31-4 as exactly 1055.06 J. + +#### Calorie + +``` +Unitful.cal +``` + +The calorie, a unit of energy defined as exactly 4.184 J. + +#### Erg + +``` +Unitful.erg +``` + +The erg, a CGS unit of energy, defined as 1 dyn × cm. + +#### eV + +``` +Unitful.eV +``` + +The electron-volt, a unit of energy, defined as q*V. + +#### Joule + +``` +Unitful.J +``` + +The joule, an SI unit of energy, defined as 1 N × m. + +### Force + +#### Dyne + +``` +Unitful.dyn +``` + +The dyne, a CGS unit of force, defined as 1 g × cm / s^2. + +#### PoundsForce + +``` +Unitful.lbf +``` + +The pound-force, a US customary unit of force defined as 1 lb × ge. + +#### Newton + +``` +Unitful.N +``` + +The newton, an SI unit of force, defined as 1 kg × m / s^2. + +### Frequency + +#### Becquerel + +``` +Unitful.Bq +``` + +The becquerel, an SI unit of radioactivity, defined as 1 nuclear decay per s. + +#### Hertz + +``` +Unitful.Hz +``` + +The hertz, an SI unit of frequency, defined as 1 s^-1. + +#### AngHertz + +``` +Unitful.Hz2π +``` + +A unit for convenience in angular frequency, equal to 2π Hz. + +#### RevolutionsPerMinute + +``` +Unitful.rpm +``` + +Revolutions per minute, a unit of rotational speed, defined as 2π rad / minute. + +#### RevolutionsPerSecond + +``` +Unitful.rps +``` + +Revolutions per second, a unit of rotational speed, defined as 2π rad / s. + +### HField + +#### Oersted + +``` +Unitful.Oe +``` + +The oersted, a CGS unit of magnetic H-field strength, defined as 1000 A / (4π × m). + +### Inductance + +#### Henry + +``` +Unitful.H +``` + +The henry, an SI unit of electrical inductance, defined as 1 J / A^2. + +### KinematicViscosity + +#### Stokes + +``` +Unitful.St +``` + +The stokes, a CGS unit of kinematic viscosity, defined as 1 cm^2 / s. + +### MagneticFlux + +#### Maxwell + +``` +Unitful.Mx +``` + +The maxwell, a CGS unit of magnetic flux, defined as 1 Gauss × cm^2. + +#### Weber + +``` +Unitful.Wb +``` + +The weber, an SI unit of magnetic flux, defined as 1 kg × m^2 / (A × s^2). + +### MolarFlow + +#### Katal + +``` +Unitful.kat +``` + +The katal, an SI unit of catalytic activity, defined as 1 mol of catalyzed substrate per s. + +### Molarity + +#### Molar + +``` +Unitful.M +``` + +A unit for measuring molar concentration, equal to 1 mol/L. + +### Power + +#### Watt + +``` +Unitful.W +``` + +The watt, an SI unit of power, defined as 1 J / s. + +### Pressure + +#### Atmosphere + +``` +Unitful.atm +``` + +The standard atmosphere, a unit of pressure, defined as 101,325 Pa. + +#### Barye + +``` +Unitful.Ba +``` + +The barye, a CGS unit of pressure, defined as 1 dyn / cm^2. + +#### Bar + +``` +Unitful.bar +``` + +The bar, a metric unit of pressure, defined as 100 kPa. + +#### Pascal + +``` +Unitful.Pa +``` + +The pascal, an SI unit of pressure, defined as 1 N / m^2. + +#### PoundsPerSquareInch + +``` +Unitful.psi +``` + +Pounds per square inch, a US customary unit of pressure defined as 1 lbf / inch^2. + +#### Torr + +``` +Unitful.Torr +``` + +The torr, a unit of pressure, defined as 1/760 atm. + +### Velocity + +#### SpeedOfLight + +``` +Unitful.c +``` + +The speed of light in a vacuum, a unit of speed, defined as exactly 2.997,924,58 × 10^8 m/s. + +`Unitful.c0` is a quantity (with units `m/s`) whereas `Unitful.c` is a unit equal to `c0`. + +### Voltage + +#### Volt + +``` +Unitful.V +``` + +The volt, an SI unit of electric potential, defined as 1 W / A. + +### Volume + +#### Liter + +``` +Unitful.L +Unitful.l +``` + +The liter, a metric unit of volume, defined as 1000 cm^3. + +## Dimensionless units + +#### Percentmille + +``` +Unitful.pcm +``` + +Percentmille, a unit meaning parts per hundred thousand. + +#### Percent + +``` +Unitful.percent +``` + +Percent, a unit meaning parts per hundred. Printed as "%". + +#### Permille + +``` +Unitful.permille +``` + +Permille, a unit meaning parts per thousand. Printed as "‰". + +#### Pertenthousand + +``` +Unitful.pertenthousand +``` + +Permyriad, a unit meaning parts per ten thousand. Printed as "‱". + +#### Perbillion + +``` +Unitful.ppb +``` + +Perbillion, a unit meaning parts per billion (in the short-scale sense), i.e., 10^-9. + +#### Permillion + +``` +Unitful.ppm +``` + +Permillion, a unit meaning parts per million. + +#### Perquadrillion + +``` +Unitful.ppq +``` + +Perquadrillion, a unit meaning parts per quadrillion (in the short-scale sense), i.e., 10^-15. + +#### Pertrillion + +``` +Unitful.ppt +``` + +Pertrillion, a unit meaning parts per trillion (in the short-scale sense), i.e., 10^-12. + +#### Radian + +``` +Unitful.rad +``` + +The radian, a unit of angle. There are 2π rad in a circle. + +#### Steradian + +``` +Unitful.sr +``` + +The steradian, a unit of spherical angle. There are 4π sr in a sphere. + +#### Degree + +``` +Unitful.° +``` + +The degree, a unit of angle. There are 360° in a circle. + +## Logarithmic units + +| Unit | Name | +|----------------|---------------------------------| +| `dB` | Decibel | +| `B` | Bel | +| `Np` | Neper | +| `cNp` | Centineper | + +### "Dimensionful" logarithmic units +| Unit | Reference level | +|----------------|---------------------------------| +| `dBHz` | 1Hz | +| `dBm` | 1mW | +| `dBV` | 1V | +| `dBu` | sqrt(0.6)V | +| `dBμV` | 1μV | +| `dBSPL` | 20μPa | +| `dBFS` | RootPowerRatio(1) | +| `dBΩ` | 1Ω | +| `dBS` | 1S | +## Physical constants + +#### G + +``` +Unitful.G +``` + +A quantity representing the universal gravitational constant, equal to 6.674,30 × 10^-11 m^3 / (kg × s^2) (the CODATA 2018 recommended value). + +#### Na + +``` +Unitful.Na +``` + +A quantity representing Avogadro's constant, defined as exactly 6.022,140,76 × 10^23 / mol. + +#### R + +``` +Unitful.R +``` + +A quantity representing the molar gas constant, defined as Na × k. + +#### R∞ + +``` +Unitful.R∞ +``` + +A quantity representing the Rydberg constant, equal to 1.097,373,156,8160 × 10^-7 / m (the CODATA 2018 recommended value). + +#### Z0 + +``` +Unitful.Z0 +``` + +A quantity representing the impedance of free space, a constant defined as μ0 × c. + +#### c0 + +``` +Unitful.c0 +``` + +A quantity representing the speed of light in a vacuum, defined as exactly 2.997,924,58 × 10^8 m/s. + +`Unitful.c0` is a quantity (with units `m/s`) whereas `Unitful.c` is a unit equal to `c0`. + +#### gn + +``` +Unitful.gn +``` + +A quantity representing the nominal acceleration due to gravity in a vacuum near the surface of the earth, defined by standard to be exactly 9.806,65 m / s^2. + +`Unitful.gn` is a quantity (with units `m/s^2`) whereas `Unitful.ge` is a unit equal to `gn`. + +#### h + +``` +Unitful.h +``` + +A quantity representing Planck's constant, defined as exactly 6.626,070,15 × 10^-34 J × s. + +#### k + +``` +Unitful.k +``` + +A quantity representing the Boltzmann constant, defined as exactly 1.380,649 × 10^-23 J / K. + +#### me + +``` +Unitful.me +``` + +A quantity representing the rest mass of an electron, equal to 9.109,383,7015 × 10^-31 kg (the CODATA 2018 recommended value). + +#### mn + +``` +Unitful.mn +``` + +A quantity representing the rest mass of a neutron, equal to 1.674,927,498,04 × 10^-27 kg (the CODATA 2018 recommended value). + +#### mp + +``` +Unitful.mp +``` + +A quantity representing the rest mass of a proton, equal to 1.672,621,923,69 × 10^-27 kg (the CODATA 2018 recommended value). + +#### q + +``` +Unitful.q +``` + +A quantity equal to the elementary charge, the charge of a single electron, with a value of exactly 1.602,176,634 × 10^-19 C. The letter `q` is used instead of `e` to avoid confusion with Euler's number. + +#### ħ + +``` +Unitful.ħ +``` + +A quantity representing the reduced Planck constant, defined as h / 2π. + +#### Φ0 + +``` +Unitful.Φ0 +``` + +A quantity representing the superconducting magnetic flux quantum, defined as h / (2 × q). + +#### ε0 + +``` +Unitful.ε0 +Unitful.ϵ0 +``` + +A quantity representing the vacuum permittivity constant, defined as 1 / (μ0 × c^2). + +#### μ0 + +``` +Unitful.μ0 +``` + +A quantity representing the vacuum permeability constant, defined as 4π × 10^-7 H / m. + +#### μB + +``` +Unitful.μB +``` + +A quantity representing the Bohr magneton, equal to q × ħ / (2 × me). + +#### σ + +``` +Unitful.σ +``` + +A quantity representing the Stefan-Boltzmann constant, defined as π^2 × k^4 / (60 × ħ^3 × c^2). + +#### ϵ0 + +``` +Unitful.ε0 +Unitful.ϵ0 +``` + +A quantity representing the vacuum permittivity constant, defined as 1 / (μ0 × c^2). + +## Metric (SI) Prefixes + +| Prefix | Name | Power of Ten | +|--------|--------|--------| +| y | yocto | -24 | +| z | zepto | -21 | +| a | atto | -18 | +| f | femto | -15 | +| p | pico | -12 | +| n | nano | -9 | +| μ | micro | -6 | +| m | milli | -3 | +| c | centi | -2 | +| d | deci | -1 | +| da | deca | 1 | +| h | hecto | 2 | +| k | kilo | 3 | +| M | mega | 6 | +| G | giga | 9 | +| T | tera | 12 | +| P | peta | 15 | +| E | exa | 18 | +| Z | zetta | 21 | +| Y | yotta | 24 | From 8bd6090cbeaeeedf4235acfc46dcc5b0609bd73f Mon Sep 17 00:00:00 2001 From: Eben60 <61665180+Eben60@users.noreply.github.com> Date: Fri, 15 Mar 2024 13:23:36 +0100 Subject: [PATCH 04/13] add OrderedDicts to docs/Project.toml --- docs/Project.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/Project.toml b/docs/Project.toml index 418f2c7b..fa0f1fc5 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -4,7 +4,9 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112" Latexify = "23fbe1c1-3f47-55db-b15f-69d7ec21a316" Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" +OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" [compat] Documenter = "1" Latexify = "0.16" +OrderedCollections = "1.6" From 06c9369024722097bf7d54d9a0309512d4a15d01 Mon Sep 17 00:00:00 2001 From: Sebastian Stock <42280794+sostock@users.noreply.github.com> Date: Sun, 21 Apr 2024 19:23:10 +0200 Subject: [PATCH 05/13] Uncomment footer --- docs/make_def-units_docs.jl | 6 +++--- docs/src/assets/defaultunits-footer.md | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/make_def-units_docs.jl b/docs/make_def-units_docs.jl index da6f9b87..c62670e2 100644 --- a/docs/make_def-units_docs.jl +++ b/docs/make_def-units_docs.jl @@ -4,7 +4,7 @@ using Unitful, OrderedCollections mdfile = "docs/src/defaultunits.md" mdheader = "docs/src/assets/defaultunits-header.md" -# mdfooter = "docs/src/assets/defaultunits-footer.md" +mdfooter = "docs/src/assets/defaultunits-footer.md" mdlogunits = "docs/src/assets/defaultunits-logunits.md" vfile = "docs/src/assets/vfile.txt" @@ -258,7 +258,7 @@ end header() = read(mdheader, String) -# footer() = read(mdfooter, String) +footer() = read(mdfooter, String) logunits() = read(mdlogunits, String) function makefulltext(sections, nodims_units, phys_consts) @@ -270,7 +270,7 @@ function makefulltext(sections, nodims_units, phys_consts) s *= logunits() s *= make_simple_section_text("Physical constants", phys_consts; isunit=false) s *= makeprefixsection(prefnamesvals()) - # s *= footer() + s *= footer() return s end diff --git a/docs/src/assets/defaultunits-footer.md b/docs/src/assets/defaultunits-footer.md index 8b137891..e69de29b 100644 --- a/docs/src/assets/defaultunits-footer.md +++ b/docs/src/assets/defaultunits-footer.md @@ -1 +0,0 @@ - From 1ea69e6c5f68987680d65a8510c4ad982b79e844 Mon Sep 17 00:00:00 2001 From: Sebastian Stock <42280794+sostock@users.noreply.github.com> Date: Mon, 22 Apr 2024 09:31:43 +0200 Subject: [PATCH 06/13] Simplify prefnamesvals() --- docs/make_def-units_docs.jl | 56 +++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/docs/make_def-units_docs.jl b/docs/make_def-units_docs.jl index c62670e2..3c09d10f 100644 --- a/docs/make_def-units_docs.jl +++ b/docs/make_def-units_docs.jl @@ -18,39 +18,35 @@ OrderedCollections.OrderedDict{String, Tuple{String, Int64}} with 20 entries: ⋮ => ⋮ """ function prefnamesvals() - prefixnamestable = [ - ("quetta" , "Q" , 1E+030 ) , - ("ronna" , "R" , 1E+027 ) , - ("yotta" , "Y" , 1E+024 ) , - ("zetta" , "Z" , 1E+021 ) , - ("exa" , "E" , 1E+018 ) , - ("peta" , "P" , 1000000000000000 ) , - ("tera" , "T" , 1000000000000 ) , - ("giga" , "G" , 1000000000 ) , - ("mega" , "M" , 1000000 ) , - ("kilo" , "k" , 1000 ) , - ("hecto" , "h" , 100 ) , - ("deca" , "da" , 10 ) , - ("deci" , "d" , 0.1 ) , - ("centi" , "c" , 0.01 ) , - ("milli" , "m" , 0.001 ) , - ("micro" , "μ" , 0.000001 ) , - ("nano" , "n" , 0.000000001 ) , - ("pico" , "p" , 1E-12 ) , - ("femto" , "f" , 1E-15 ) , - ("atto" , "a" , 1E-18 ) , - ("zepto" , "z" , 1E-21 ) , - ("yocto" , "y" , 1E-24 ) , - ("ronto" , "r" , 1E-27 ) , - ] + prefixnames = Dict( + "Q" => "quetta", + "R" => "ronna", + "Y" => "yotta", + "Z" => "zetta", + "E" => "exa", + "P" => "peta", + "T" => "tera", + "G" => "giga", + "M" => "mega", + "k" => "kilo", + "h" => "hecto", + "da" => "deca", + "d" => "deci", + "c" => "centi", + "m" => "milli", + "μ" => "micro", + "n" => "nano", + "p" => "pico", + "f" => "femto", + "a" => "atto", + "z" => "zepto", + "y" => "yocto", + "r" => "ronto", + "q" => "quecto") pd = Unitful.prefixdict sxp = sort(collect(keys(pd))) - pnn = Dict([p[2] => p[1] for p in prefixnamestable]) - pnv = Dict([p[2] => p[3] for p in prefixnamestable]) - - @assert all([log10(pnv[v]) == k for (k, v) in pd if pd[k] != ""]) - return OrderedDict([pd[k] => (pnn[pd[k]], k) for k in sxp if pd[k] != ""]) + return OrderedDict(pd[k] => (prefixnames[pd[k]], k) for k in sxp if pd[k] != "") end regularid(n) = ! startswith(string(n), r"#|@") From 5f9bdc9265ff1942cfbc23b70d501880ea6ee7e6 Mon Sep 17 00:00:00 2001 From: Sebastian Stock <42280794+sostock@users.noreply.github.com> Date: Mon, 22 Apr 2024 10:29:18 +0200 Subject: [PATCH 07/13] Style changes --- docs/make_def-units_docs.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/make_def-units_docs.jl b/docs/make_def-units_docs.jl index 3c09d10f..72cb4c6e 100644 --- a/docs/make_def-units_docs.jl +++ b/docs/make_def-units_docs.jl @@ -49,15 +49,15 @@ function prefnamesvals() return OrderedDict(pd[k] => (prefixnames[pd[k]], k) for k in sxp if pd[k] != "") end -regularid(n) = ! startswith(string(n), r"#|@") +regularid(n) = !startswith(string(n), r"#|@") -uful_ids() = [n for n in names(Unitful; all=true) if regularid(n)] +uful_ids() = filter(regularid, names(Unitful; all=true)) docstr(n::Symbol) = Base.Docs.doc(Base.Docs.Binding(Unitful, n)) |> string isprefixed(u::Symbol) = occursin("A prefixed unit, equal", docstr(u)) -isdocumented(n::Symbol) = ! startswith(docstr(n), "No documentation found.") +isdocumented(n::Symbol) = !startswith(docstr(n), "No documentation found.") """ # Examples @@ -89,8 +89,8 @@ Filters the list of `Unitful` identifiers to return those which denote physical """ getphysdims(uids) = [n for n in uids if (getproperty(Unitful, n) isa UnionAll) && - ! endswith(string(n), "Units") && - ! occursin("Scale", string(n)) && + !endswith(string(n), "Units") && + !occursin("Scale", string(n)) && !isempty(gettypes(getproperty(Unitful, n)))] """ From 23b077164f79d959173d66d7dcc246a325668791 Mon Sep 17 00:00:00 2001 From: Sebastian Stock <42280794+sostock@users.noreply.github.com> Date: Mon, 22 Apr 2024 11:36:28 +0200 Subject: [PATCH 08/13] Rewrite getphysdims, getdim, getdimpars, isnodims --- docs/make_def-units_docs.jl | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/docs/make_def-units_docs.jl b/docs/make_def-units_docs.jl index 72cb4c6e..3b6099a9 100644 --- a/docs/make_def-units_docs.jl +++ b/docs/make_def-units_docs.jl @@ -87,11 +87,11 @@ end getphysdims(uids::Vector{Symbol}) Filters the list of `Unitful` identifiers to return those which denote physical dimensions (e.g. `Area`, `Power`) """ -getphysdims(uids) = [n for n in uids - if (getproperty(Unitful, n) isa UnionAll) && - !endswith(string(n), "Units") && - !occursin("Scale", string(n)) && - !isempty(gettypes(getproperty(Unitful, n)))] +getphysdims(uids) = filter(isphysdim, uids) + +isphysdim(n::Symbol) = _isphysdim(getproperty(Unitful, n)) +_isphysdim(_) = false +_isphysdim(::Type{Union{Quantity{T,D,U}, Level{L,S,Quantity{T,D,U}} where {L,S}} where {T,U}}) where D = true """ # Examples @@ -100,7 +100,7 @@ julia> getdim(Unitful.Area) 𝐋^2 ``` """ -getdim(x::Type) = gettypes(x)[1].parameters[2] +getdim(::Type{Union{Quantity{T,D,U}, Level{L,S,Quantity{T,D,U}} where {L,S}} where {T,U}}) where D = D getdim(x::Symbol) = getdim(getproperty(Unitful, x)) """ @@ -110,11 +110,12 @@ julia> getdimpars(Unitful.Power) svec((Unitful.Dimension{:Length}(2//1), Unitful.Dimension{:Mass}(1//1), Unitful.Dimension{:Time}(-3//1))) ``` """ -getdimpars(x) = getproperty(typeof(getdim(x)), :parameters) -getdimpar(x) = getdimpars(x)[1][1] -getdimpow(x) = getdimpar(x).power +getdimpars(x) = getdimpars(getdim(x)) +getdimpars(::Unitful.Dimensions{N}) where N = N + +getdimpow(x) = only(getdimpars(x)).power -isbasicdim(x) = length(getdimpars(x)[1])== 1 && getdimpow(x) == 1 +isbasicdim(x) = length(getdimpars(x)) == 1 && getdimpow(x) == 1 function physdims_categories(physdims) basicdims = Symbol[] @@ -181,7 +182,7 @@ end function isnodims(u) u isa Unitful.FreeUnits || return false - return getproperty(typeof(u), :parameters)[2] == NoDims + return dimension(u) == NoDims end isnodims(u::Symbol) = isnodims(getproperty(Unitful, u)) From 3ff78531bd09a88f205a1a4faf9aa70e8f1ed51f Mon Sep 17 00:00:00 2001 From: Sebastian Stock <42280794+sostock@users.noreply.github.com> Date: Mon, 22 Apr 2024 13:01:00 +0200 Subject: [PATCH 09/13] Remove gettypes function --- docs/make_def-units_docs.jl | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/docs/make_def-units_docs.jl b/docs/make_def-units_docs.jl index 3b6099a9..9777758e 100644 --- a/docs/make_def-units_docs.jl +++ b/docs/make_def-units_docs.jl @@ -59,30 +59,6 @@ isprefixed(u::Symbol) = occursin("A prefixed unit, equal", docstr(u)) isdocumented(n::Symbol) = !startswith(docstr(n), "No documentation found.") -""" -# Examples -```julia-repl -julia> gettypes(Unitful.Power) -1-element Vector{DataType}: - Quantity{T, 𝐋^2 𝐌 𝐓^-3, U} -``` -""" -function gettypes(x::Type) - if x isa UnionAll - return gettypes(x.body) - elseif x isa Union - pns = propertynames(x) - ts = [getproperty(x, pn) for pn in pns] - ts = [t for t in ts if (t isa Type) && (t <: Unitful.Quantity)] - return ts - elseif x <: Unitful.Quantity - return [x] - else - return [] - end -end - - """ getphysdims(uids::Vector{Symbol}) Filters the list of `Unitful` identifiers to return those which denote physical dimensions (e.g. `Area`, `Power`) From ef06d02c84f90d874692e06e118e9c76842f140e Mon Sep 17 00:00:00 2001 From: Sebastian Stock <42280794+sostock@users.noreply.github.com> Date: Mon, 22 Apr 2024 13:17:03 +0200 Subject: [PATCH 10/13] Rewrite nameofunit(u) --- docs/make_def-units_docs.jl | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/docs/make_def-units_docs.jl b/docs/make_def-units_docs.jl index 9777758e..0cdfe2e0 100644 --- a/docs/make_def-units_docs.jl +++ b/docs/make_def-units_docs.jl @@ -175,17 +175,14 @@ udoc(s) = match(r"(?ms)(.+)\n\nDimension: ", docstr(s)).captures[1] |> removeref function nameofunit(u) special = Dict(u"ha" => "Hectare", u"kg" => "Kilogram", u"°F" => "Degree Fahrenheit", u"°C" => "Degree Celcius") u in keys(special) && return special[u] - t = typeof(u) - ps = getproperty(t, :parameters) - u1 = ps[1][1] - @assert u1 isa Unitful.Unit - t1 = typeof(u1) - uname = getproperty(t1, :parameters)[1] - return string(uname) + return string(_nameofunit(u)) end nameofunit(s::Symbol) = nameofunit(getproperty(Unitful, s)) +_nameofunit(::Unitful.Units{N}) where N = _nameofunit(only(N)) +_nameofunit(::Unitful.Unit{U}) where U = U + function make_subsection_text(uvec; isunit=true) s = "" for u in uvec From b30d64b7cef2edeb8fedb81eed6a9e94bce69b70 Mon Sep 17 00:00:00 2001 From: Sebastian Stock <42280794+sostock@users.noreply.github.com> Date: Tue, 23 Apr 2024 12:24:16 +0200 Subject: [PATCH 11/13] Rename subsections --- docs/make_def-units_docs.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/make_def-units_docs.jl b/docs/make_def-units_docs.jl index 0cdfe2e0..881d98d8 100644 --- a/docs/make_def-units_docs.jl +++ b/docs/make_def-units_docs.jl @@ -272,8 +272,8 @@ function make_chapter(wr = true; verbose = false) basic_units = unitsdict(basicdims, uids) compound_units = unitsdict(compounddims, uids) nodims_units = nodimsunits(uids) - sections = OrderedDict(["Basic dimensions" => basic_units, - "Compound dimensions" => compound_units]) + sections = OrderedDict(["Base dimensions" => basic_units, + "Derived dimensions" => compound_units]) phys_consts = physconstants(uids) fulltext = makefulltext(sections, nodims_units, phys_consts) From 4b840cc2b0e6cbc5991963b1483a017a98a1efd6 Mon Sep 17 00:00:00 2001 From: Sebastian Stock <42280794+sostock@users.noreply.github.com> Date: Wed, 24 Apr 2024 14:55:26 +0200 Subject: [PATCH 12/13] Shorten section title and remove spaces before linebreaks --- docs/make_def-units_docs.jl | 8 +- docs/src/assets/defaultunits-header.md | 2 +- docs/src/defaultunits.md | 462 ++++++++++++------------- 3 files changed, 236 insertions(+), 236 deletions(-) diff --git a/docs/make_def-units_docs.jl b/docs/make_def-units_docs.jl index 881d98d8..141f7fa4 100644 --- a/docs/make_def-units_docs.jl +++ b/docs/make_def-units_docs.jl @@ -192,19 +192,19 @@ function make_subsection_text(uvec; isunit=true) n = string(u) end d = udoc(u) - s *= "#### $n \n\n$d \n\n" + s *= "#### $n\n\n$d\n\n" end return s end function make_simple_section_text(sectiontitle, uvec; isunit=true) - s = "## $sectiontitle \n\n" + s = "## $sectiontitle\n\n" s *= make_subsection_text(uvec; isunit) return s end function make_structured_section_text(sectiontitle, sectiondict) - s = "## $sectiontitle \n\n" + s = "## $sectiontitle\n\n" for (dim, uvec) in sectiondict s *= "### $dim\n\n" s *= make_subsection_text(uvec) @@ -220,7 +220,7 @@ function makeprefixsection(pnv) |--------|--------|--------| """ for (k,v) in pnv - s *= "| $k | $(v[1]) | $(v[2]) | \n" + s *= "| $k | $(v[1]) | $(v[2]) |\n" end return s diff --git a/docs/src/assets/defaultunits-header.md b/docs/src/assets/defaultunits-header.md index 36ac4987..e2ac90ce 100644 --- a/docs/src/assets/defaultunits-header.md +++ b/docs/src/assets/defaultunits-header.md @@ -1,4 +1,4 @@ -# Units and сonstants pre-defined in the `Unitful` package +# Pre-defined units and сonstants In the following, only non-prefixed units are listed. To get a more detailed information about a unit, and to get information about prefixed units, use `Julia` help, e.g. diff --git a/docs/src/defaultunits.md b/docs/src/defaultunits.md index 259a3920..7d1325fe 100644 --- a/docs/src/defaultunits.md +++ b/docs/src/defaultunits.md @@ -1,4 +1,4 @@ -# Units and сonstants pre-defined in the `Unitful` package +# Pre-defined units and сonstants In the following, only non-prefixed units are listed. To get a more detailed information about a unit, and to get information about prefixed units, use `Julia` help, e.g. @@ -16,268 +16,268 @@ help?> Unitful.kW For prefixes, see [below](#Metric-(SI)-Prefixes). -## Basic dimensions +## Base dimensions ### Amount -#### Mole +#### Mole ``` Unitful.mol ``` -The mole, the SI base unit for amount of substance. +The mole, the SI base unit for amount of substance. ### Current -#### Ampere +#### Ampere ``` Unitful.A ``` -The ampere, the SI base unit of electric current. +The ampere, the SI base unit of electric current. ### Length -#### Angstrom +#### Angstrom ``` Unitful.angstrom Unitful.Å ``` -The angstrom, a metric unit of length defined as 1/10 nm. +The angstrom, a metric unit of length defined as 1/10 nm. -#### Foot +#### Foot ``` Unitful.ft ``` -The foot, a US customary unit of length defined as 12 inch. +The foot, a US customary unit of length defined as 12 inch. -#### Inch +#### Inch ``` Unitful.inch ``` -The inch, a US customary unit of length defined as 2.54 cm. +The inch, a US customary unit of length defined as 2.54 cm. -#### Meter +#### Meter ``` Unitful.m ``` -The meter, the SI base unit of length. +The meter, the SI base unit of length. -#### Mile +#### Mile ``` Unitful.mi ``` -The mile, a US customary unit of length defined as 1760 yd. +The mile, a US customary unit of length defined as 1760 yd. -#### Mil +#### Mil ``` Unitful.mil ``` -The mil, a US customary unit of length defined as 1/1000 inch. +The mil, a US customary unit of length defined as 1/1000 inch. -#### Yard +#### Yard ``` Unitful.yd ``` -The yard, a US customary unit of length defined as 3 ft. +The yard, a US customary unit of length defined as 3 ft. ### Luminosity -#### Candela +#### Candela ``` Unitful.cd ``` -The candela, the SI base unit of luminous intensity. +The candela, the SI base unit of luminous intensity. -#### Lumen +#### Lumen ``` Unitful.lm ``` -The lumen, an SI unit of luminous flux, defined as 1 cd × sr. +The lumen, an SI unit of luminous flux, defined as 1 cd × sr. ### Mass -#### Dram +#### Dram ``` Unitful.dr ``` -The dram, a US customary unit of mass defined as 1/16 oz. +The dram, a US customary unit of mass defined as 1/16 oz. -#### Gram +#### Gram ``` Unitful.g ``` -A prefixed unit, equal to 10^-3 kg. Note that `kg`, not `g`, is the base unit. +A prefixed unit, equal to 10^-3 kg. Note that `kg`, not `g`, is the base unit. -#### Grain +#### Grain ``` Unitful.gr ``` -The grain, a US customary unit of mass defined as 1/7000 lb. +The grain, a US customary unit of mass defined as 1/7000 lb. -#### Kilogram +#### Kilogram ``` Unitful.kg ``` -The kilogram, the SI base unit of mass. Note that `kg`, not `g`, is the base unit. +The kilogram, the SI base unit of mass. Note that `kg`, not `g`, is the base unit. -#### Pound +#### Pound ``` Unitful.lb ``` -The pound-mass, a US customary unit of mass defined as exactly 0.453,592,37 kg. +The pound-mass, a US customary unit of mass defined as exactly 0.453,592,37 kg. -#### Ounce +#### Ounce ``` Unitful.oz ``` -The ounce, a US customary unit of mass defined as 1/16 lb. +The ounce, a US customary unit of mass defined as 1/16 lb. -#### Slug +#### Slug ``` Unitful.slug ``` -The slug, a US customary unit of mass defined as 1 lbf × s^2 / ft. +The slug, a US customary unit of mass defined as 1 lbf × s^2 / ft. -#### UnifiedAtomicMassUnit +#### UnifiedAtomicMassUnit ``` Unitful.u ``` -The unified atomic mass unit, or dalton, a unit of mass defined as 1/12 the mass of an unbound neutral atom of carbon-12, equal to 1.660,539,066,60 × 10^-27 kg (the CODATA 2018 recommended value). +The unified atomic mass unit, or dalton, a unit of mass defined as 1/12 the mass of an unbound neutral atom of carbon-12, equal to 1.660,539,066,60 × 10^-27 kg (the CODATA 2018 recommended value). ### Temperature -#### Kelvin +#### Kelvin ``` Unitful.K ``` -The kelvin, the SI base unit of thermodynamic temperature. +The kelvin, the SI base unit of thermodynamic temperature. -#### Rankine +#### Rankine ``` Unitful.Ra ``` -The rankine, a US customary unit of temperature defined as 5/9 K. +The rankine, a US customary unit of temperature defined as 5/9 K. -#### Degree Celcius +#### Degree Celcius ``` Unitful.°C ``` -The degree Celsius, an SI unit of temperature, defined such that 0 °C = 273.15 K. +The degree Celsius, an SI unit of temperature, defined such that 0 °C = 273.15 K. -#### Degree Fahrenheit +#### Degree Fahrenheit ``` Unitful.°F ``` -The degree Fahrenheit, a US customary unit of temperature, defined such that 0 °F = 459.67 Ra. +The degree Fahrenheit, a US customary unit of temperature, defined such that 0 °F = 459.67 Ra. ### Time -#### Day +#### Day ``` Unitful.d ``` -The day, a unit of time defined as 24 hr. +The day, a unit of time defined as 24 hr. -#### Hour +#### Hour ``` Unitful.hr ``` -The hour, a unit of time defined as 60 minutes. +The hour, a unit of time defined as 60 minutes. -#### Minute +#### Minute ``` Unitful.minute ``` -The minute, a unit of time defined as 60 s. The full name `minute` is used instead of the symbol `min` to avoid confusion with the Julia function `min`. +The minute, a unit of time defined as 60 s. The full name `minute` is used instead of the symbol `min` to avoid confusion with the Julia function `min`. -#### Second +#### Second ``` Unitful.s ``` -The second, the SI base unit of time. +The second, the SI base unit of time. -#### Week +#### Week ``` Unitful.wk ``` -The week, a unit of time, defined as 7 d. +The week, a unit of time, defined as 7 d. -#### Year +#### Year ``` Unitful.yr ``` -The year, a unit of time, defined as 365.25 d. +The year, a unit of time, defined as 365.25 d. -## Compound dimensions +## Derived dimensions ### Acceleration -#### Gal +#### Gal ``` Unitful.Gal ``` -The gal, a CGS unit of acceleration, defined as 1 cm / s^2. +The gal, a CGS unit of acceleration, defined as 1 cm / s^2. -#### EarthGravity +#### EarthGravity ``` Unitful.ge @@ -285,351 +285,351 @@ Unitful.ge The nominal acceleration due to gravity in a vacuum near the surface of the earth, a unit of acceleration, defined by standard to be exactly 9.806,65 m / s^2. -`Unitful.gn` is a quantity (with units `m/s^2`) whereas `Unitful.ge` is a unit equal to `gn`. +`Unitful.gn` is a quantity (with units `m/s^2`) whereas `Unitful.ge` is a unit equal to `gn`. ### Area -#### Are +#### Are ``` Unitful.a ``` -The are, a metric unit of area, defined as 100 m^2. +The are, a metric unit of area, defined as 100 m^2. -#### Acre +#### Acre ``` Unitful.ac ``` -The acre, a US customary unit of area defined as 4840 yd^2. +The acre, a US customary unit of area defined as 4840 yd^2. -#### Barn +#### Barn ``` Unitful.b ``` -The barn, a metric unit of area, defined as 100 fm^2. +The barn, a metric unit of area, defined as 100 fm^2. -#### Hectare +#### Hectare ``` Unitful.ha ``` -The hectare, a metric unit of area, defined as 100 a. +The hectare, a metric unit of area, defined as 100 a. ### BField -#### Gauss +#### Gauss ``` Unitful.Gauss ``` -The gauss, a CGS unit of magnetic B-field strength, defined as 1 Mx / cm^2. +The gauss, a CGS unit of magnetic B-field strength, defined as 1 Mx / cm^2. -#### Tesla +#### Tesla ``` Unitful.T ``` -The tesla, an SI unit of magnetic B-field strength, defined as 1 kg / (A × s^2). +The tesla, an SI unit of magnetic B-field strength, defined as 1 kg / (A × s^2). ### Capacitance -#### Farad +#### Farad ``` Unitful.F ``` -The farad, an SI unit of electrical capacitance, defined as 1 s^4 × A^2 / (kg × m^2). +The farad, an SI unit of electrical capacitance, defined as 1 s^4 × A^2 / (kg × m^2). ### Charge -#### Coulomb +#### Coulomb ``` Unitful.C ``` -The coulomb, an SI unit of electric charge, defined as 1 A × s. +The coulomb, an SI unit of electric charge, defined as 1 A × s. ### DynamicViscosity -#### Poise +#### Poise ``` Unitful.P ``` -The poise, a CGS unit of dynamic viscosity, defined as 1 dyn × s / cm^2. +The poise, a CGS unit of dynamic viscosity, defined as 1 dyn × s / cm^2. ### ElectricalConductance -#### Siemens +#### Siemens ``` Unitful.S ``` -The siemens, an SI unit of electrical conductance, defined as 1 Ω^-1. +The siemens, an SI unit of electrical conductance, defined as 1 Ω^-1. ### ElectricalResistance -#### Ohm +#### Ohm ``` Unitful.Ω ``` -The ohm, an SI unit of electrical resistance, defined as 1 V / A. +The ohm, an SI unit of electrical resistance, defined as 1 V / A. ### Energy -#### BritishThermalUnit +#### BritishThermalUnit ``` Unitful.btu ``` -The British thermal unit, a US customary unit of heat defined by ISO 31-4 as exactly 1055.06 J. +The British thermal unit, a US customary unit of heat defined by ISO 31-4 as exactly 1055.06 J. -#### Calorie +#### Calorie ``` Unitful.cal ``` -The calorie, a unit of energy defined as exactly 4.184 J. +The calorie, a unit of energy defined as exactly 4.184 J. -#### Erg +#### Erg ``` Unitful.erg ``` -The erg, a CGS unit of energy, defined as 1 dyn × cm. +The erg, a CGS unit of energy, defined as 1 dyn × cm. -#### eV +#### eV ``` Unitful.eV ``` -The electron-volt, a unit of energy, defined as q*V. +The electron-volt, a unit of energy, defined as q*V. -#### Joule +#### Joule ``` Unitful.J ``` -The joule, an SI unit of energy, defined as 1 N × m. +The joule, an SI unit of energy, defined as 1 N × m. ### Force -#### Dyne +#### Dyne ``` Unitful.dyn ``` -The dyne, a CGS unit of force, defined as 1 g × cm / s^2. +The dyne, a CGS unit of force, defined as 1 g × cm / s^2. -#### PoundsForce +#### PoundsForce ``` Unitful.lbf ``` -The pound-force, a US customary unit of force defined as 1 lb × ge. +The pound-force, a US customary unit of force defined as 1 lb × ge. -#### Newton +#### Newton ``` Unitful.N ``` -The newton, an SI unit of force, defined as 1 kg × m / s^2. +The newton, an SI unit of force, defined as 1 kg × m / s^2. ### Frequency -#### Becquerel +#### Becquerel ``` Unitful.Bq ``` -The becquerel, an SI unit of radioactivity, defined as 1 nuclear decay per s. +The becquerel, an SI unit of radioactivity, defined as 1 nuclear decay per s. -#### Hertz +#### Hertz ``` Unitful.Hz ``` -The hertz, an SI unit of frequency, defined as 1 s^-1. +The hertz, an SI unit of frequency, defined as 1 s^-1. -#### AngHertz +#### AngHertz ``` Unitful.Hz2π ``` -A unit for convenience in angular frequency, equal to 2π Hz. +A unit for convenience in angular frequency, equal to 2π Hz. -#### RevolutionsPerMinute +#### RevolutionsPerMinute ``` Unitful.rpm ``` -Revolutions per minute, a unit of rotational speed, defined as 2π rad / minute. +Revolutions per minute, a unit of rotational speed, defined as 2π rad / minute. -#### RevolutionsPerSecond +#### RevolutionsPerSecond ``` Unitful.rps ``` -Revolutions per second, a unit of rotational speed, defined as 2π rad / s. +Revolutions per second, a unit of rotational speed, defined as 2π rad / s. ### HField -#### Oersted +#### Oersted ``` Unitful.Oe ``` -The oersted, a CGS unit of magnetic H-field strength, defined as 1000 A / (4π × m). +The oersted, a CGS unit of magnetic H-field strength, defined as 1000 A / (4π × m). ### Inductance -#### Henry +#### Henry ``` Unitful.H ``` -The henry, an SI unit of electrical inductance, defined as 1 J / A^2. +The henry, an SI unit of electrical inductance, defined as 1 J / A^2. ### KinematicViscosity -#### Stokes +#### Stokes ``` Unitful.St ``` -The stokes, a CGS unit of kinematic viscosity, defined as 1 cm^2 / s. +The stokes, a CGS unit of kinematic viscosity, defined as 1 cm^2 / s. ### MagneticFlux -#### Maxwell +#### Maxwell ``` Unitful.Mx ``` -The maxwell, a CGS unit of magnetic flux, defined as 1 Gauss × cm^2. +The maxwell, a CGS unit of magnetic flux, defined as 1 Gauss × cm^2. -#### Weber +#### Weber ``` Unitful.Wb ``` -The weber, an SI unit of magnetic flux, defined as 1 kg × m^2 / (A × s^2). +The weber, an SI unit of magnetic flux, defined as 1 kg × m^2 / (A × s^2). ### MolarFlow -#### Katal +#### Katal ``` Unitful.kat ``` -The katal, an SI unit of catalytic activity, defined as 1 mol of catalyzed substrate per s. +The katal, an SI unit of catalytic activity, defined as 1 mol of catalyzed substrate per s. ### Molarity -#### Molar +#### Molar ``` Unitful.M ``` -A unit for measuring molar concentration, equal to 1 mol/L. +A unit for measuring molar concentration, equal to 1 mol/L. ### Power -#### Watt +#### Watt ``` Unitful.W ``` -The watt, an SI unit of power, defined as 1 J / s. +The watt, an SI unit of power, defined as 1 J / s. ### Pressure -#### Atmosphere +#### Atmosphere ``` Unitful.atm ``` -The standard atmosphere, a unit of pressure, defined as 101,325 Pa. +The standard atmosphere, a unit of pressure, defined as 101,325 Pa. -#### Barye +#### Barye ``` Unitful.Ba ``` -The barye, a CGS unit of pressure, defined as 1 dyn / cm^2. +The barye, a CGS unit of pressure, defined as 1 dyn / cm^2. -#### Bar +#### Bar ``` Unitful.bar ``` -The bar, a metric unit of pressure, defined as 100 kPa. +The bar, a metric unit of pressure, defined as 100 kPa. -#### Pascal +#### Pascal ``` Unitful.Pa ``` -The pascal, an SI unit of pressure, defined as 1 N / m^2. +The pascal, an SI unit of pressure, defined as 1 N / m^2. -#### PoundsPerSquareInch +#### PoundsPerSquareInch ``` Unitful.psi ``` -Pounds per square inch, a US customary unit of pressure defined as 1 lbf / inch^2. +Pounds per square inch, a US customary unit of pressure defined as 1 lbf / inch^2. -#### Torr +#### Torr ``` Unitful.Torr ``` -The torr, a unit of pressure, defined as 1/760 atm. +The torr, a unit of pressure, defined as 1/760 atm. ### Velocity -#### SpeedOfLight +#### SpeedOfLight ``` Unitful.c @@ -637,118 +637,118 @@ Unitful.c The speed of light in a vacuum, a unit of speed, defined as exactly 2.997,924,58 × 10^8 m/s. -`Unitful.c0` is a quantity (with units `m/s`) whereas `Unitful.c` is a unit equal to `c0`. +`Unitful.c0` is a quantity (with units `m/s`) whereas `Unitful.c` is a unit equal to `c0`. ### Voltage -#### Volt +#### Volt ``` Unitful.V ``` -The volt, an SI unit of electric potential, defined as 1 W / A. +The volt, an SI unit of electric potential, defined as 1 W / A. ### Volume -#### Liter +#### Liter ``` Unitful.L Unitful.l ``` -The liter, a metric unit of volume, defined as 1000 cm^3. +The liter, a metric unit of volume, defined as 1000 cm^3. -## Dimensionless units +## Dimensionless units -#### Percentmille +#### Percentmille ``` Unitful.pcm ``` -Percentmille, a unit meaning parts per hundred thousand. +Percentmille, a unit meaning parts per hundred thousand. -#### Percent +#### Percent ``` Unitful.percent ``` -Percent, a unit meaning parts per hundred. Printed as "%". +Percent, a unit meaning parts per hundred. Printed as "%". -#### Permille +#### Permille ``` Unitful.permille ``` -Permille, a unit meaning parts per thousand. Printed as "‰". +Permille, a unit meaning parts per thousand. Printed as "‰". -#### Pertenthousand +#### Pertenthousand ``` Unitful.pertenthousand ``` -Permyriad, a unit meaning parts per ten thousand. Printed as "‱". +Permyriad, a unit meaning parts per ten thousand. Printed as "‱". -#### Perbillion +#### Perbillion ``` Unitful.ppb ``` -Perbillion, a unit meaning parts per billion (in the short-scale sense), i.e., 10^-9. +Perbillion, a unit meaning parts per billion (in the short-scale sense), i.e., 10^-9. -#### Permillion +#### Permillion ``` Unitful.ppm ``` -Permillion, a unit meaning parts per million. +Permillion, a unit meaning parts per million. -#### Perquadrillion +#### Perquadrillion ``` Unitful.ppq ``` -Perquadrillion, a unit meaning parts per quadrillion (in the short-scale sense), i.e., 10^-15. +Perquadrillion, a unit meaning parts per quadrillion (in the short-scale sense), i.e., 10^-15. -#### Pertrillion +#### Pertrillion ``` Unitful.ppt ``` -Pertrillion, a unit meaning parts per trillion (in the short-scale sense), i.e., 10^-12. +Pertrillion, a unit meaning parts per trillion (in the short-scale sense), i.e., 10^-12. -#### Radian +#### Radian ``` Unitful.rad ``` -The radian, a unit of angle. There are 2π rad in a circle. +The radian, a unit of angle. There are 2π rad in a circle. -#### Steradian +#### Steradian ``` Unitful.sr ``` -The steradian, a unit of spherical angle. There are 4π sr in a sphere. +The steradian, a unit of spherical angle. There are 4π sr in a sphere. -#### Degree +#### Degree ``` Unitful.° ``` -The degree, a unit of angle. There are 360° in a circle. +The degree, a unit of angle. There are 360° in a circle. ## Logarithmic units @@ -771,49 +771,49 @@ The degree, a unit of angle. There are 360° in a circle. | `dBFS` | RootPowerRatio(1) | | `dBΩ` | 1Ω | | `dBS` | 1S | -## Physical constants +## Physical constants -#### G +#### G ``` Unitful.G ``` -A quantity representing the universal gravitational constant, equal to 6.674,30 × 10^-11 m^3 / (kg × s^2) (the CODATA 2018 recommended value). +A quantity representing the universal gravitational constant, equal to 6.674,30 × 10^-11 m^3 / (kg × s^2) (the CODATA 2018 recommended value). -#### Na +#### Na ``` Unitful.Na ``` -A quantity representing Avogadro's constant, defined as exactly 6.022,140,76 × 10^23 / mol. +A quantity representing Avogadro's constant, defined as exactly 6.022,140,76 × 10^23 / mol. -#### R +#### R ``` Unitful.R ``` -A quantity representing the molar gas constant, defined as Na × k. +A quantity representing the molar gas constant, defined as Na × k. -#### R∞ +#### R∞ ``` Unitful.R∞ ``` -A quantity representing the Rydberg constant, equal to 1.097,373,156,8160 × 10^-7 / m (the CODATA 2018 recommended value). +A quantity representing the Rydberg constant, equal to 1.097,373,156,8160 × 10^-7 / m (the CODATA 2018 recommended value). -#### Z0 +#### Z0 ``` Unitful.Z0 ``` -A quantity representing the impedance of free space, a constant defined as μ0 × c. +A quantity representing the impedance of free space, a constant defined as μ0 × c. -#### c0 +#### c0 ``` Unitful.c0 @@ -821,9 +821,9 @@ Unitful.c0 A quantity representing the speed of light in a vacuum, defined as exactly 2.997,924,58 × 10^8 m/s. -`Unitful.c0` is a quantity (with units `m/s`) whereas `Unitful.c` is a unit equal to `c0`. +`Unitful.c0` is a quantity (with units `m/s`) whereas `Unitful.c` is a unit equal to `c0`. -#### gn +#### gn ``` Unitful.gn @@ -831,135 +831,135 @@ Unitful.gn A quantity representing the nominal acceleration due to gravity in a vacuum near the surface of the earth, defined by standard to be exactly 9.806,65 m / s^2. -`Unitful.gn` is a quantity (with units `m/s^2`) whereas `Unitful.ge` is a unit equal to `gn`. +`Unitful.gn` is a quantity (with units `m/s^2`) whereas `Unitful.ge` is a unit equal to `gn`. -#### h +#### h ``` Unitful.h ``` -A quantity representing Planck's constant, defined as exactly 6.626,070,15 × 10^-34 J × s. +A quantity representing Planck's constant, defined as exactly 6.626,070,15 × 10^-34 J × s. -#### k +#### k ``` Unitful.k ``` -A quantity representing the Boltzmann constant, defined as exactly 1.380,649 × 10^-23 J / K. +A quantity representing the Boltzmann constant, defined as exactly 1.380,649 × 10^-23 J / K. -#### me +#### me ``` Unitful.me ``` -A quantity representing the rest mass of an electron, equal to 9.109,383,7015 × 10^-31 kg (the CODATA 2018 recommended value). +A quantity representing the rest mass of an electron, equal to 9.109,383,7015 × 10^-31 kg (the CODATA 2018 recommended value). -#### mn +#### mn ``` Unitful.mn ``` -A quantity representing the rest mass of a neutron, equal to 1.674,927,498,04 × 10^-27 kg (the CODATA 2018 recommended value). +A quantity representing the rest mass of a neutron, equal to 1.674,927,498,04 × 10^-27 kg (the CODATA 2018 recommended value). -#### mp +#### mp ``` Unitful.mp ``` -A quantity representing the rest mass of a proton, equal to 1.672,621,923,69 × 10^-27 kg (the CODATA 2018 recommended value). +A quantity representing the rest mass of a proton, equal to 1.672,621,923,69 × 10^-27 kg (the CODATA 2018 recommended value). -#### q +#### q ``` Unitful.q ``` -A quantity equal to the elementary charge, the charge of a single electron, with a value of exactly 1.602,176,634 × 10^-19 C. The letter `q` is used instead of `e` to avoid confusion with Euler's number. +A quantity equal to the elementary charge, the charge of a single electron, with a value of exactly 1.602,176,634 × 10^-19 C. The letter `q` is used instead of `e` to avoid confusion with Euler's number. -#### ħ +#### ħ ``` Unitful.ħ ``` -A quantity representing the reduced Planck constant, defined as h / 2π. +A quantity representing the reduced Planck constant, defined as h / 2π. -#### Φ0 +#### Φ0 ``` Unitful.Φ0 ``` -A quantity representing the superconducting magnetic flux quantum, defined as h / (2 × q). +A quantity representing the superconducting magnetic flux quantum, defined as h / (2 × q). -#### ε0 +#### ε0 ``` Unitful.ε0 Unitful.ϵ0 ``` -A quantity representing the vacuum permittivity constant, defined as 1 / (μ0 × c^2). +A quantity representing the vacuum permittivity constant, defined as 1 / (μ0 × c^2). -#### μ0 +#### μ0 ``` Unitful.μ0 ``` -A quantity representing the vacuum permeability constant, defined as 4π × 10^-7 H / m. +A quantity representing the vacuum permeability constant, defined as 4π × 10^-7 H / m. -#### μB +#### μB ``` Unitful.μB ``` -A quantity representing the Bohr magneton, equal to q × ħ / (2 × me). +A quantity representing the Bohr magneton, equal to q × ħ / (2 × me). -#### σ +#### σ ``` Unitful.σ ``` -A quantity representing the Stefan-Boltzmann constant, defined as π^2 × k^4 / (60 × ħ^3 × c^2). +A quantity representing the Stefan-Boltzmann constant, defined as π^2 × k^4 / (60 × ħ^3 × c^2). -#### ϵ0 +#### ϵ0 ``` Unitful.ε0 Unitful.ϵ0 ``` -A quantity representing the vacuum permittivity constant, defined as 1 / (μ0 × c^2). +A quantity representing the vacuum permittivity constant, defined as 1 / (μ0 × c^2). ## Metric (SI) Prefixes | Prefix | Name | Power of Ten | |--------|--------|--------| -| y | yocto | -24 | -| z | zepto | -21 | -| a | atto | -18 | -| f | femto | -15 | -| p | pico | -12 | -| n | nano | -9 | -| μ | micro | -6 | -| m | milli | -3 | -| c | centi | -2 | -| d | deci | -1 | -| da | deca | 1 | -| h | hecto | 2 | -| k | kilo | 3 | -| M | mega | 6 | -| G | giga | 9 | -| T | tera | 12 | -| P | peta | 15 | -| E | exa | 18 | -| Z | zetta | 21 | -| Y | yotta | 24 | +| y | yocto | -24 | +| z | zepto | -21 | +| a | atto | -18 | +| f | femto | -15 | +| p | pico | -12 | +| n | nano | -9 | +| μ | micro | -6 | +| m | milli | -3 | +| c | centi | -2 | +| d | deci | -1 | +| da | deca | 1 | +| h | hecto | 2 | +| k | kilo | 3 | +| M | mega | 6 | +| G | giga | 9 | +| T | tera | 12 | +| P | peta | 15 | +| E | exa | 18 | +| Z | zetta | 21 | +| Y | yotta | 24 | From 2269b48c255dc5aa0fb3053801942616eb91e82d Mon Sep 17 00:00:00 2001 From: Ben Elkin <8xe8n-cm@online.de> Date: Sat, 1 Jun 2024 17:36:16 +0200 Subject: [PATCH 13/13] ignore doctest errors --- docs/make.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/make.jl b/docs/make.jl index c76dea89..00efac12 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -25,7 +25,7 @@ DocMeta.setdocmeta!(Unitful, :DocTestSetup, :(using Unitful)) makedocs( sitename = "Unitful.jl", format = Documenter.HTML(prettyurls = ci), - warnonly = [:missing_docs], + warnonly = [:missing_docs, :doctest], modules = [Unitful], workdir = joinpath(@__DIR__, ".."), pages = [