Skip to content

← deep_learning package

RandomCapRotationAugmentation

Simulate small rotations of the cap montage to augment neural data.

This node draws random rotations in degrees from a given distribution, scaled by some provided factors, and then simulates a rotation of the montage (e.g., EEG cap) about these angles by interpolating the data to rotated positions. Note that this is best applied to time-domain data and may not give entirely correct results when used with e.g., precomputed frequency spectra or powers. A good starting point is a unit normal or truncated normal distribution, and using the provided scale factors, which simulate a typical level of inaccuracy in cap placement. For data that was collected under highly controlled conditions, you may want to use smaller scale factors. This node requires the data to have a space axis with x/y/z coordinates correctly assigned (relative to head center) for all channels; this can be achieved using the Assign Channel Locations node beforehand, and removing any unlocalized channels using the Remove Unlocalized Channels node. Like most augmentation nodes, this node does not by itself amplify the amount of data, which therefore has to be done beforehand using, for example, the RepeatAlongAxis node. Also As with most augmentation nodes, you need to wire in a random seed (for example using the DrawRandomSeed node, see docs for more info) to ensure reproducibility. You also need to wire a distribution to the dist input to specify the distribution of interest (e.g., NormalDistribution). Version 0.1.1

Ports/Properties

data

Data to process.

  • verbose name: Data
  • default value: None
  • port type: DataPort
  • value type: Packet (can be None)
  • data direction: INOUT

seed

Random seed for deterministic results.

  • verbose name: Seed
  • default value: None
  • port type: DataPort
  • value type: AnyArray (can be None)
  • data direction: IN

dist

Distribution to use.

  • verbose name: Dist
  • default value: None
  • port type: GraphPort
  • value type: Graph

is_training

Whether the node is used in training mode.

  • verbose name: Is Training
  • default value: None
  • port type: DataPort
  • value type: bool (can be None)
  • data direction: IN

xyz_rot_scale

A comma-separated list of scale factors to apply to the drawn rotation amounts for the x, y, and z axes. The resulting scaled values are then assumed to be in a unit of degrees; therefore, you may either use a distribution with unit standard deviation and then specify the scale factors here in degrees, or your distribution's standard deviation is set to degrees, and you may use [1,1,1] here (or smaller values to reduce or disable the amount of rotation applied for a given axis). A value of 3.0 degrees corresponds to a maximum movement of approx. half a centimeter on the scalp, but when rotating about multiple axes, you may use a slightly lower value such that the different movements combine to approx. the same total. When using non-uniform scaling, verify that x, y, and z in your data correspond to the axes that you expect. The NeuroPype default is x=right, y=front, z=up, so that the corresponding rotations are pitch, roll, and yaw (applied in that order).

  • verbose name: Scale Random Numbers For X,y,z (Degrees)
  • default value: [2.5, 2.5, 1.0]
  • port type: ListPort
  • value type: list (can be None)

num_rotations

Number of rotations to draw from the distribution. This node will initially draw and cache a fixed set of rotations. Then, every single instance in the data will be transformed by a randomly chosen rotation. Note that an excessively large number will result in longer initialization time and more memory use, incl. GPU memory when applied to GPU data.

  • verbose name: Num Rotations
  • default value: 100
  • port type: IntPort
  • value type: int (can be None)

rot_seed

Random seed (int or None) for precomputing candidate rotations. Note that this seed should usually not be driven by a wire but left fixed since it's a precomputation.

  • verbose name: Rot Seed
  • default value: 12345
  • port type: IntPort
  • value type: int (can be None)

bypass

Whether to bypass the augmentation and pass the input data through unchanged.

  • verbose name: Bypass
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

set_breakpoint

Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.

  • verbose name: Set Breakpoint (Debug Only)
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

metadata

User-definable meta-data associated with the node. Usually reserved for technical purposes.

  • verbose name: Metadata
  • default value: {}
  • port type: DictPort
  • value type: dict (can be None)