Fourier compatibility adapters¶
Existing calls preserve Fourier values, closure bins, selector behavior, and
Amp_/Phase_ names. New code should follow Unified sequence-transform API to select the
primary full-bin schema deliberately. Recompute and refit before changing a
trained model’s feature definition.
- class protspect.features.SequenceFFT(sequence, attributes=None)[source]¶
Compatibility wrapper for the historical Fourier sequence API.
New code can use Sequence.compute_transform for any backend. compute_spectra and compute_spectral_properties preserve the original closed bins and names.
- compute_cross_spectra()¶
Store upper-triangle channel products
X_i * conjugate(X_j).Includes auto-spectra; keys are
channel_i_channel_j. Products inherit both input channels’ preprocessing. There is no additional normalization or statistical averaging of cross-products.
- compute_spectra(length, *, normalization='none', center=False)¶
Store frequency-centered FFTs after optional signal scaling and padding.
- Parameters:
length (int) – FFT length, at least the sequence length. Each stored spectrum has
length + 1entries: the first centered bin is repeated at the end for periodic closure.frequencycontains matching cycles per residue, including the repeated bin shifted by one cycle.normalization ({"none", "length", "sqrt_length", "energy"}, optional) – Divide channel values by 1, residue count N, sqrt(N), or L2 norm, respectively, before padding. Energy uses the optionally centered channel; zero-energy channels stay zero. Defaults to raw scaling.
center (bool, optional) – Subtract the channel mean over actual residues before scaling and padding. This is distinct from centering FFT bins with fftshift.
- compute_spectral_properties(spectra_types=('spectra', ), select_method=<function frequency_select_physical>, compute_amplitude=True, compute_phase=False)¶
Return selected spectral amplitudes and/or phases as a dictionary.
- Parameters:
spectra_types (iterable of str) –
spectraand/orcross_spectra, computed beforehand.select_method (callable) – Receives
frequencyand returns a same-shape boolean mask.compute_amplitude (bool) – Include absolute magnitudes and/or phases in radians, respectively.
compute_phase (bool) – Include absolute magnitudes and/or phases in radians, respectively.
- Returns:
Scalar features named
Amp_<channel>_<frequency>orPhase_<channel>_<frequency>. Magnitudes inherit preprocessing from compute_spectra; this export applies no further normalization.- Return type:
dict
- class protspect.sklearn.SpectralTransformer(*, embedding=None, spectrum_length=None, normalization='none', center=False, standardize_channels=False, spectra_types=('spectra', ), select_method=<function frequency_select_physical>, compute_amplitude=True, compute_phase=False)[source]¶
Compatibility adapter for the original fitted Fourier feature API.
All fitting, transformation, channel preprocessing, and feature extraction delegate to SequenceTransformer. The original constructor, closed frequency grid,
Amp_/Phase_feature names, and get_feature_metadata schema are preserved. New code should use SequenceTransformer for every transform.
- SequenceSet.export_datatable(spectra=('spectra', ), attributes=None, select_method=<function frequency_select_physical>, compute_amplitude=True, compute_phase=False)[source]¶
Return a pandas DataFrame with one row per sequence.
spectrachooses computed spectrum types.attributeslists metadata columns to copy; selectors and amplitude/phase flags followSequenceFFT.compute_spectral_properties(). Populate the set first.
- ComplexSet.export_datatable(chain_ID='AB', attributes=None, select_method=<function frequency_select_physical>, compute_amplitude=True, compute_phase=False)[source]¶
Return a feature DataFrame for
chain_IDA, B, or AB.attributeslists metadata columns; frequency selection and feature flags followSequenceFFT.compute_spectral_properties(). Populate the paired set before calling this method.