upsp.processing.kulite_utilities
Kulites class and helpers
-
class Kulites(data_dir, run, seq, kulites='all', data_type=<class 'numpy.float32'>, psf=False, f_type='slow')[source]
Bases: object
Load and manage kulite data
Data is in PSI unless optional psf argument is True
- Parameters
data_dir (str
) – directory with *.info
, *.slow
, *.fast
files
run (int
) – run number
seq (int
) – sequence number
kulites (list
) – kulites to load
data_type (numpy.dtype
) – data type of array elements
f_type (str
) – ‘slow’ or ‘fast’
-
data
Dictionary with Kulite names as keys and numnpy arrays with pressure time
histoires as values.
- Type
dict
-
apply_filter(kulites, sosfilter)[source]
Apply an sos filter to the given kulite collection, and return a new kulites object.
Creates a deep copy in case you want to use this for comparing filtered
vs unfiltered collections, and want to hang on to an unmodified version too
-
compute_delta_rms(kulites, sosfilter=None)[source]
calculate rms values for each kulite by subtracting off the mean, and return a dict.
if sosfilter is provided, applies it to the timeseries before calculating rms
-
compute_psd(kulites, w_len=1024)[source]
Compute PSDs for kulite data
- Parameters
-
- Returns
Dictionary of PSDs for each kulite, with an additional entry “freq” for the
frequency bins
- Return type
dict
-
compute_rms_from_psd(kulites, startfreq=None)[source]
calculate rms values for each kulite in the input collection by integrating its psd
if startfreq is provided, integrates from startfreq upwards
-
create_kulite_grid(tgts_file, kul_strs)[source]
Generate a structured grid of kulite locations
- Parameters
-
- Returns
kul_grid – kulite positions in cartesion and cylindrical form
- Return type
StructGrid
-
create_pressure_array(kuls, data_type=<class 'numpy.float32'>)[source]
Generate a numpy array with kulite pressure-time histories
- Parameters
-
- Returns
kulite data
- Return type
numpy.ndarray
-
read_targets_matrix(tgts_file, kul_strs)[source]
Generate a list of kulite data
- Parameters
-
- Returns
Kulite data of the form: name, x, y, z, r, theta, i, j, k, diam, zone
- Return type
list
of list
-
read_tgts(tgts_file, kulites='all')[source]
Read in the tgts file data and return the coordinates of the kulites
- Parameters
tgts_file (str
) – targets data file
kulites (list
, optional) – list of kulite strings. If “all” (default), all targets identified as Kulites
are returned.
- Returns
pos – (x,y,z) positions for each kulite keyed by name
- Return type
dict
of list
-
write_kulite_positions_p3d(output_file, tgts_file, kul_strs)[source]
Generate a 1D plot3d grid with kulite locations
- Parameters
output_file (str
) – output p3d file
tgts_file (str
) – TGTS kulite location file
kul_strs (list
) – kulite names to include in plots