Skip to main content

alignment.ChannelModel

alignment.ChannelModel(
    repo_id=CHANNEL_MODEL_REPO_ID,
    revision=CHANNEL_MODEL_REVISION,
    device=None,
    *,
    trilinear_context=None,
    neighbour_draws=None,
)

The published channel-level model, with array-level helpers used by every alignment method.

Args: repo_id (str, optional): Hugging Face repo id or a local release directory. revision (str, optional): Release tag. device (str, optional): Torch device; auto-detected when None. trilinear_context, neighbour_draws: How the model predicts; by default, what the release says. See :meth:~ephysatlas.models.encoder_inpainting.SpatialEncoder.predict_xyz.

Attributes

Name Description
conf_model The probe-confidence model shipped with the release (None when it ships none).
model_commit The Hub snapshot the model was loaded from (its directory name), or ’’.

Methods

Name Description
confidence [C] p(good) of each channel of a probe placed at channel_xyz.
context_raw [N, F_ctx] raw molecular context (MERFISH PCs then AGEA PCs), as the unit model uses.
context_std [N, F_ctx] standardised molecular context (all zero outside the atlas).
predict [N, F] predicted features (feature units) at xyz_m, through the released model’s
predict_std [N, F] standardised predictions at xyz_m, excluding pid’s own neighbours.
split The release’s probe split (train_pids, validation_pids, test_pids).
standardize Recorded features in model units (NaN/inf set to 0), float64.
unstandardize Model units back to feature units.

confidence

alignment.ChannelModel.confidence(recorded, channel_xyz, predicted_std)

[C] p(good) of each channel of a probe placed at channel_xyz.

The released probe-confidence transformer reads, along the probe, the recorded and predicted (standardised) features and the context at each channel; class 0 is “good”. Invalid channels (no signal, non-finite position or prediction) are NaN. All NaN when the release ships no confidence model.

context_raw

alignment.ChannelModel.context_raw(xyz_m)

[N, F_ctx] raw molecular context (MERFISH PCs then AGEA PCs), as the unit model uses.

context_std

alignment.ChannelModel.context_std(xyz_m)

[N, F_ctx] standardised molecular context (all zero outside the atlas).

predict

alignment.ChannelModel.predict(xyz_m, pid='', batch_size=2048)

[N, F] predicted features (feature units) at xyz_m, through the released model’s public :meth:~ephysatlas.models.encoder_inpainting.SpatialEncoder.predict.

pid labels every position (the pid level of the index predict reads), so the probe’s own channels are excluded from the model’s neighbours; ’’ excludes nothing.

predict_std

alignment.ChannelModel.predict_std(xyz_m, pid='', batch_size=2048)

[N, F] standardised predictions at xyz_m, excluding pid’s own neighbours.

:meth:predict in model units: the exact inverse of the release’s X * std + mean.

split

alignment.ChannelModel.split()

The release’s probe split (train_pids, validation_pids, test_pids).

standardize

alignment.ChannelModel.standardize(features)

Recorded features in model units (NaN/inf set to 0), float64.

unstandardize

alignment.ChannelModel.unstandardize(features_std)

Model units back to feature units.