API

This page contains the main API reference.

Core Primitives

pmrf.Model(*[, name, metadata])

Base class for RF models.

pmrf.Module(*[, name, metadata])

Base class for parameter-aware objects in ParamRF.

pmrf.Frequency([start, stop, npoints, unit])

A frequency axis used to evaluate models over.

pmrf.Param(*[, value, distribution, ...])

The canonical parameter container for ParamRF.

pmrf.Unconstrained(value, *[, fixed, scale, ...])

Create an unconstrained free parameter.

pmrf.Fixed(value, *[, name, scale, metadata])

Create a fixed parameter.

pmrf.Bounded(lower, upper, *[, value, ...])

Create a free parameter constrained within a specific interval.

pmrf.Constrained(constraint, value, *[, ...])

Create a free parameter constrained to a specific domain.

pmrf.Random(distribution, *[, constraint, ...])

Create a free parameter with an associated probability distribution.

Working with Parameters

pmrf.params(tree[, where, free_only])

Returns the parameters of a model, or any collection of models, by name.

pmrf.values(tree[, where, free_only, space])

Returns the values of a model's parameters by name, in one space.

pmrf.log_prior(tree, *[, space])

Returns the log prior density of a model's parameters, in one space.

pmrf.update(tree, selection, node, /, *, ...)

Returns a copy of a model with the parts a selector picks replaced.

pmrf.tie(tree, target, ~typing.Any], source, ...)

Returns a copy of a model in which one part is derived from another.

pmrf.resolve(tree)

Returns a copy of a tree with its ties applied and its parameters left intact.

pmrf.derived(fn)

Turns a function of a base model and new parameters into a derived model constructor.

Main Modules

pmrf.models

RF models, components, surrogates, and adapters, and their solvers.

pmrf.modules

Parameter-aware wrappers for ParamRF modules.

pmrf.materials

Frequency-dependent materials.

pmrf.parameters

Parameter factories, converters, and field specifiers.

pmrf.stats

Public stats modules and their common entry points.

pmrf.objectives

Public objectives modules and their common entry points.

pmrf.optimize

Non-linear optimization of RF models.

pmrf.infer

Bayesian inference of RF models.

pmrf.fitting

Higher-level fitting utilities.

Other Modules

pmrf.math

Core maths functions.

pmrf.rf

Core RF conversions and system representations.

pmrf.serialization

Model loading and saving.

pmrf.viz

Plotting and vizualization.

Utilities

pmrf.NetworkCollection([networks, name, params])

A container for a collection of scikit-rf Networks.

pmrf.Partial(func, /, *args, **kwargs)

(experimental) Like functools.partial, but JAX-compatible.

pmrf.Attrgetter(*attrs)

(experimental) Like operator.attrgetter, but registered as a PyTree.

pmrf.Pathgetter(*paths)

(experimental) Retrieves values from a PyTree given JAX tree paths.

pmrf.InitVar(type)

pmrf.is_param(x)

Returns if x is an instance of pmrf.Param.

pmrf.as_param([value, constraint, scale, ...])

Coerces a value into a parameter.

pmrf.param(*, default, as_free, as_fixed, ...)

A field specifier for registering parameters within a model.

pmrf.partition(pytree, filter_spec[, is_leaf])

Splits a PyTree into two halves based on a filtering rule.

pmrf.combine(*pytrees[, is_leaf])

Recombines previously partitioned PyTrees into a single, functional PyTree.

pmrf.batch_axes(batched, template, *[, is_leaf])

Generates an in_axes PyTree by comparing a batched model to a template.

pmrf.batch_mask(batched, template, *[, is_leaf])

Generates a boolean PyTree mask identifying which leaves have a batch dimension.

pmrf.field(*[, converter, static])

Equinox supports extra functionality on top of the default dataclasses.

pmrf.load(source)

(experimental) Load a ParamRF Model (or any Parax PyTree) from a file.

pmrf.save(target, tree)

(experimental) Save a ParamRF Model (or any Parax PyTree) to a file.

pmrf.derivative(eval_fn, *args[, space])

Computes the exact derivative of a function.

pmrf.sweep(eval_fn, *args[, grid, template])

Vectorizes a function over the given input arguments.

pmrf.freeze(value)

Freezes/fixes a parameter or entire model and returns the frozen model.

pmrf.unfreeze(value)

Unfreezes/unfixes a potentially frozen parameter or model and returns the unfrozen model.

pmrf.replace(obj, /, **changes)

Returns a copy of a dataclass, such as a model or parameter, with fields replaced.

pmrf.unwrap(tree[, only_if, cascade])

Recursively resolves AbstractUnwrappable nodes within a PyTree.

pmrf.unwrap_self(method)

Decorator for Equinox module methods.