Flip

class of dascore.proc.basic
inherits from: PatchProcessor, DascoreBaseModel, pydantic.main.BaseModel
source

Flip(
    *args ,
    dims: tuple[Any, …] = (),
    flip_coords: bool = True,
)-> None

Flip patch data and (optionally coords) along specified dimensions.

Parameters

Parameter Description
patch The patch to flip.
*dims The dimensions over which to flip (mirror).
flip_coords If True, also flip coords associated with dimensions, otherwise
leave them unchanged.

Examples

import dascore as dc
import numpy as np
patch = dc.get_example_patch()

# Flip patch over time axis
out = patch.flip("time")
assert np.all(patch.get_array("time") == out.get_array("time")[::-1])

# Flip patch over all dimensions.
out = patch.flip(*patch.dims)

Methods

Name Description
check Refuse a patch which does not carry what the operation needs.
chunk_contract Return what a chunk of the output needs of the input, or None.
get_metadata Return the flipped metadata and the axes to mirror.
halo Return how far along an axis the kernel reads to fill a sample.
kernel Return the data mirrored along the axes; the data if there are none.
model_copy Copy the model, dropping cached values the update invalidates.
new Create new instance with some attributed updated.
flip Flip patch data and (optionally coords) along specified dimensions.
reconcile Return metadata or a patch holding the final data; default as is.
run Run the operation: check, get_metadata, kernel, reconcile, record.