visualdynamics.io.rattlesnake_sine¶
rattlesnake_sine
¶
Read Rattlesnake sine specification files (.npz), one tone per file.
The controller's sine environment saves each specification the way its
own save_specification writes it: frequency (the breakpoints),
amplitude (channels by breakpoints, the specification table's column
transposed), and sweep_type and sweep_rate for each segment; and,
from the controller versions that have them, phase in degrees,
warning and abort as (lower/upper, left/right, channels,
breakpoints), start_time and name. Files from older versions lack
some of the optional arrays, and read as well.
The file names no channels and has no units. The channels are named in
the controller's own order, '1', '2' and so on, which is also how a run
through a response transformation records them, unless response_dof
names them; the amplitudes are read as written unless ordinate_unit
gives their unit. Nine files are nine specifications of one tone each;
Project.merge joins them into one.
Functions:
| Name | Description |
|---|---|
sniff |
True for an |
load |
Read one tone as the controller wrote it. |
Classes¶
Functions:¶
sniff
¶
True for an .npz with the four arrays every sine specification
has, and without the random specification's f and cpsd, since
the two formats come from the same controller and are otherwise
unrelated.
Source code in src/visualdynamics/io/rattlesnake_sine.py
load
¶
load(path: str | PathLike, response_dof: Sequence[str] | None = None, ordinate_dim: str = 'acceleration', ordinate_unit: str | None = None) -> SineSweepSpecification
Read one tone as the controller wrote it.
The phase is converted from degrees to radians. The warning and
abort bands must be the same on the left and right sides of each
breakpoint, since a tone here has one value per breakpoint; a file
where they differ is refused. The tone is named by the file's name,
or by the file name without it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or PathLike
|
The |
required |
response_dof
|
sequence of str
|
The control channels the amplitude columns belong to, in the file's order. Defaults to '1', '2', ..., the controller's channel order, which is how a run through a response transformation names them. |
None
|
ordinate_dim
|
str
|
What the amplitudes measure. |
'acceleration'
|
ordinate_unit
|
str
|
The amplitudes' unit. None keeps the file's values as they are, to be read beside data in the same unit. |
None
|
Returns:
| Type | Description |
|---|---|
SineSweepSpecification
|
A specification of one tone. |
Raises:
| Type | Description |
|---|---|
ValueError
|
For a file with no breakpoints, a |
Source code in src/visualdynamics/io/rattlesnake_sine.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |