nistxray

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package nistxray fetches and reads NIST X-Ray Mass Attenuation Coefficients, Standard Reference Database 126, and the tables of Hubbell and Seltzer.

Its tables give mass attenuation μ/ρ and mass energy-absorption μen/ρ coefficients for every element Z = 1 to 92, plus 48 compounds and mixtures.

The tables cover materials of dosimetric interest, from 1 keV to 20 MeV. NIST last updated the data in July 2004. The archive is the pages themselves, asked by page: an element's, a compound's, and the four pages of contents and material constants that go with them.

The data is not open. In NIST's own words on the database's page: "© 1989, 1990, 1996 copyright by the U.S. Secretary of Commerce on behalf of the United States of America. All rights reserved. NIST reserves the right to charge for these data in the future."

Work using it cites "Hubbell, J.H. and Seltzer, S.M. (2004), Tables of X-Ray Mass Attenuation Coefficients and Mass Energy-Absorption Coefficients (version 1.4). [Online] Available: http://physics.nist.gov/xaamdi", doi 10.18434/T4D01F.

NIST serves each page through Cloudflare, which appends to every response a script of its own. The one line carrying "window.__CF$cv$params=" holds a per-request ray id and timestamp, so no two fetches of the same page have the same bytes.

A page is pinned by the sum of its content, not its bytes: its content is the page as NIST serves it with that one line removed, and nothing else removed. The rule takes whole lines, and only those with Cloudflare's mark.

Any other change that NIST or Cloudflare makes leaves the sum wrong and the fetch refused, never silently passed. The rule was proved when the pages were pinned: each was fetched twice on 2026-11-11.

Every pair differed on the wire in exactly that one line while the sums of their content agreed. Two fetches are kept in testdata as z82-a.html and z82-b.html, and a test reads them: that test is the evidence the rule earns its keep.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() (*celestialdata.Fixed, error)

New is the database's archive, asked by name only. It holds every page the manifest records — the 92 element pages, the 48 compound pages and the 4 pages of contents and constants — each held to the length the manifest measured and to the sum of its content.

Types

type Constants

type Constants struct {
	Z       int
	Symbol  string
	Name    string
	OverA   float64 // the mean ratio of atomic number to mass
	Density float64 // in g/cm^3
	Row     string  // the row's own cells, joined
}

Constants is one material's row of Table 1 or Table 2, the constants NIST assumed in its evaluations: the mean ratio of atomic number to mass Z/A and the density, with the row's own text.

Z and Symbol are the element's, and none for a compound; Name is the row's own name. NIST warns of the densities in both tables: "Some density values are only nominal."

func Material

func Material(pages fs.FS, name string) (Constants, error)

Material is a material's row of constants, read from the folder the archive's pages were fetched into, by the name the table writes: an element's symbol, such as "Pb" or "Al", or a compound's name, such as "Water, Liquid" or "Adipose Tissue (ICRU-44)".

It refuses a material neither table holds, by name, a page the folder does not hold, by name, and a row whose numbers will not read, naming the page.

type Content

type Content struct {
	// contains filtered or unexported fields
}

Content is the sha256 sum of a page's content: the page as NIST serves it, with the one line Cloudflare injects removed. It contains nothing but the sum, so products stay comparable, as a Checker should.

It is the check every page the archive holds is held to, as celestialdata's Digest checks a file whose bytes do not change.

func ContentOf

func ContentOf(raw []byte) Content

ContentOf is the sum of a page's bytes as its content: the bytes with every line that carries Cloudflare's mark removed, whole lines, and nothing else removed.

func ParseContent

func ParseContent(text string) (Content, error)

ParseContent is the sha256 sum text holds, written in 64 hex characters, in either case. It refuses a text of any other length, and one that is not hex, saying which.

func (Content) Check

func (content Content) Check(page string) error

Check says nothing for a fetched page whose content has this sum, or why not: the page's path, the sum its content should have had, and the sum it has. A page that will not read is wrapped with its path.

func (Content) String

func (content Content) String() string

String is the sum as lowercase hex.

type Row

type Row struct {
	Edge        string
	Energy      float64 // in MeV
	MuOverRho   float64 // in cm^2/g
	MuEnOverRho float64 // in cm^2/g
}

Row is one energy's coefficients, as the page records them. Edge is the label the row carries in its first column, when it carries one: "K" for an element's K edge, "11 K" for the K edge of the sodium, Z 11, in a compound.

A row at an edge is a second measurement at the same energy, and the label is NIST's own for it; Edge is empty when the page gives none.

type Table

type Table struct {
	// contains filtered or unexported fields
}

Table is one page's coefficients: what the page says of itself, and its rows.

func Compound

func Compound(pages fs.FS, name string) (Table, error)

Compound is a compound's or mixture's page of coefficients, read from the folder the archive's pages were fetched into, by the name of the page as NIST's address takes it: "water" for water, "air" for dry air, "a150" for A-150 tissue-equivalent plastic.

It refuses a compound whose page the folder does not hold, by name, a page that holds no table of rows, by the page's name, and a row that is not three numbers with at most two labels before them, by the page's name.

func Element

func Element(pages fs.FS, z int) (Table, error)

Element is an element's page of coefficients, read from the folder the archive's pages were fetched into, by atomic number: 82 for lead, whose page NIST names z82.html.

It refuses an element whose page the archive does not hold, by name, a page that holds no table of rows, by the page's name, and a row that is not three numbers with at most two labels before them, by the page's name.

func (Table) Header

func (table Table) Header() string

Header is the page's own title for its table, as the page writes it: "Lead\nZ = 82" for an element, "Water, Liquid" for a compound. The pages state no density of their own and carry no citation of their own: the densities are in Table 1 and Table 2.

The citation is the database's, in the package's sources.yaml.

func (Table) Rows

func (table Table) Rows() []Row

Rows is the page's coefficients, an energy each, in the page's order. Nothing is interpolated and nothing is derived: the rows are the page's own, handed out as it records them.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL