pyrite.montecarlo.spectrum.mc_brem_spectrum#

pyrite.montecarlo.spectrum.mc_brem_spectrum(segments, E_grid_eV, element=None, n_atoms_per_ang3=None, theta_obs_rad=np.float64(2.076941809873252), n_hat=None, chunk=20000, composition=None, layers=None, groove=None, electron_limit=None, E_cut_keV=None, cross_section_model='auto', bremslib_tables=None, electron_band_weights=None)#

Return the incoherent bremsstrahlung density from transport segments.

The result is the Beer–Lambert-attenuated track-length estimate in photons per eV per sr per incident electron toward n_hat. EEDL MF=23/MT=527 totals and MF=26/MT=527 photon distributions emit isotropically and are the "auto" fallback; the retained Bethe–Heitler backend is selectable and supplies missing-coverage fallback. "bremslib" weights each segment by the BremsLib double differential cross section at its emission angle arccos(v_hat . n_hat). Source equations, geometry assumptions, interpolation rules, and limiting cases are documented in docs/physics/radiation-physics/bremsstrahlung.md.

Parameters:
  • segments – Transport output mapping from simulate_trajectories().

  • E_grid_eV – One-dimensional continuum photon-energy grid in eV.

  • element – Elemental target symbol and number density, superseded by composition.

  • n_atoms_per_ang3 – Elemental target symbol and number density, superseded by composition.

  • theta_obs_rad – Polar observation angle in radians when n_hat is absent.

  • n_hat – Optional three-component observation direction in the sample frame.

  • chunk – Maximum transport segments processed per reduction chunk.

  • composition – Compound (element, number_density) pairs in atoms per cubic angstrom.

  • layers – Optional film-first absorber stack.

  • groove – Optional supported blazed-groove escape geometry.

  • electron_limit – Optional leading macro-electron count used for normalization.

  • E_cut_keV – Optional post-transport electron-energy cutoff in keV.

  • cross_section_model (Literal['eedl', 'bethe-heitler', 'bremslib', 'auto']) – "auto" (default) uses the direction-resolved BremsLib model when a table resolves for every composition element (the supplied bremslib_tables, else the installed release), and otherwise warns and uses "eedl". Every model needs segment directions v_hat for the segment escape integral and raises ValueError without them. "eedl" selects evaluated MF=23/527 totals and normalized MF=26/527 photon spectra, "bethe-heitler" the retained analytic Bethe–Heitler + Elwert backend, and "bremslib" the direction-resolved BremsLib model. Missing EEDL coverage warns and falls back to Bethe–Heitler for affected elements or segments; an element without a BremsLib table, or a segment energy outside it, warns and falls back to isotropic EEDL.

  • bremslib_tables (Mapping[str, BremsLibBremsstrahlungTable] | None) – Required with "bremslib": staged tables keyed by element symbol, from pyrite.xsgen.bremslib.tables.load_bremsstrahlung_tables().

  • electron_band_weights – Internal (#361). Quadrature weights in eV over E_grid_eV; when given, the call instead returns each of the Ne electrons’ own in-band integral sum_E q_E dN_e/dE dOmega (photons per sr), whose mean over electrons is the band integral of the returned density. It always takes the chunked path, so on a device the reduction order differs from the fused kernels; it feeds stopping statistics only.

Returns:

Continuum density in photons per incident electron per eV per sr, or with electron_band_weights the (Ne,) per-electron band integrals.

Return type:

numpy.ndarray

Raises:
  • ValueError – If composition or requested escape geometry is inconsistent.

  • Validation – brem-spectrum, finite-transverse-crystal, blazed-groove-geometry,:

  • bremslib-angular-model –

  • Validation – segment-escape-average:

  • Validation – substep-radiation-invariance:

  • Validation – adaptive-sample-size-stopping: