utils
Shared utilities for bilayer analyses.
funcspecies_by_resname(build_input) → dict[str, object]Return a mapping of residue name to species object.
parambuild_input'BuildInput'Returns
dict[str, object]funclipid_species_by_resname(build_input) → dict[str, LipidSpecies]Return lipid species keyed by residue name.
parambuild_input'BuildInput'Returns
dict[str, LipidSpecies]funcwater_resnames(build_input) → list[str]funcresidue_atoms(residue, atom_indices) → Any | NoneReturn AtomGroup for indices present in the residue.
paramresidue'Residue'paramatom_indicesIterable[int]Returns
typing.Any | Nonefuncresidue_mean_position(residue, atom_indices) → np.ndarray | NoneReturn the mean position of atom indices in a residue.
paramresidue'Residue'paramatom_indicesIterable[int]Returns
numpy.numpy.ndarray | Nonefuncresidue_atom_positions(residue, atom_indices) → np.ndarrayReturn stacked positions for the requested atom indices in a residue.
paramresidue'Residue'paramatom_indicesIterable[int]Returns
numpy.numpy.ndarrayfuncheadgroup_positions(universe, resname, head_atoms) → np.ndarrayReturn mean headgroup positions for each residue of a species.
paramuniverse'mda.Universe'paramresnamestrparamhead_atomsIterable[int]Returns
numpy.numpy.ndarrayfunctail_positions(universe, resname, tail_atoms) → np.ndarrayReturn stacked tail atom positions for a species.
paramuniverse'mda.Universe'paramresnamestrparamtail_atomsIterable[int]Returns
numpy.numpy.ndarrayfunctrajectory_window(universe, *, start_ns=None, end_ns=None, last_ns=None, stride=1) → tuple[int, int, int]Return start/stop/step indices for a trajectory window.
paramuniversemda.UniverseMDAnalysis Universe with loaded trajectory
paramstart_nsfloat | None= NoneStart analysis from this time in nanoseconds. Ignored when last_ns is set.
paramend_nsfloat | None= NoneStop analysis at this time in nanoseconds.
paramlast_nsfloat | None= NoneAnalyze the last N ns of the trajectory. Takes precedence over start_ns.
paramstrideint= 1Frame stride (step size)
Returns
tuple(start_frame, stop_frame, step) for trajectory slicing
funcmidplane_from_positions(positions) → float | NoneReturn the median z-position used for leaflet assignment.
parampositionsnp.ndarrayReturns
float | Nonefuncframe_time_ns(ts) → floatReturn the current frame time in nanoseconds.
paramtsAnyReturns
floatfuncrun_per_frame_analysis(func, trajectory, *args, **run_kwargs) → listRun a per-frame analysis, preserving variable-length results as a list.
Wraps AnalysisFromFunction but overrides _conclude to prevent numpy conversion of results, which fails when per-frame outputs have variable lengths (ragged arrays).
paramfunccallablePer-frame analysis function passed to AnalysisFromFunction
paramtrajectoryMDAnalysis trajectoryTrajectory to iterate over
paramargsAny= ()paramrun_kwargsAny= {}Returns
listPer-frame results as a Python list (not coerced to ndarray)
