vishack.data.diaggui¶
A dtt2hdf wrapper for extracting data from diaggui XML output files
Classes
|
Diaggui class for handling and converting diaggui XML file. |
-
class
vishack.data.diaggui.
Diaggui
(path)¶ Bases:
object
Diaggui class for handling and converting diaggui XML file.
- Parameters
path (string) – The path to the diaggui XML output file.
-
items
¶ The output from
dtt2hdf.read_diaggui(path)
.- Type
declarative.bunch.bunch.Bunch
-
path
¶ The path to the diaggui XML output file.
- Type
string
-
coh
(channel_a, channel_b, datatype='results')¶ Read coherence from diaggui file.
- Parameters
channel_a (string) – The input channel string.
channel_b (string) – The output channel string.
- Returns
f (array) – The frequency axis of the coherence.
cohdata (array) – The coherence between channel_a and channel_b.
-
csd
(channel_a, channel_b, datatype='results')¶ Read cross-PSD from diaggui file.
- Parameters
channel_a (string) – The input channel string.
channel_b (string) – The output channel string.
- Returns
f (array) – The frequency axis of the cross-power sepctral density.
csddata (array) – The cross-power spectral density, in complex numbers.
-
get_reference
(index)¶ Read a reference plot from the diaggui XML file
- Parameters
index (int) – The index of the reference plot in the diaggui XML
- Returns
A dictionary with various useful info about the reference.
- Return type
dict
Note
The dict is taken from dtt2hdf.read_diaggui().references[index]. Useful keys are ‘type_name’, ‘channelA’, ‘channelB’, ‘channelB_inv’, ‘df’, ‘FHz’, ‘xfer’, ‘PSD’, ‘CSD’, ‘coherence’.
Example
Here, reference #0 is the transfer function from BS_TM_L to BS_TM_L.
In[0]: import vishack.data.diaggui dg = vishack.data.diaggui.Diaggui(path='data/BS_TML_exc_20200730a.xml') dg.reference_dict(0)
Out[0]: {'gps_second': 1238215044.0078125, 'subtype_raw': 0, 'f0': 0.0, 'df': 0.0078125, 'BW': 0.0117187, 'window_raw': 1, 'window': 'Hanning', 'avgtype_raw': 0, 'avgtype': 'Fixed', 'averages': 1, 'channelA': 'K1:VIS-BS_TM_LOCK_L_EXC', 'channelB': array(['K1:VIS-BS_TM_OPLEV_LEN_DIAG'], dtype='<U27'), 'channelB_inv': {'K1:VIS-BS_TM_OPLEV_LEN_DIAG': 0}, 'subtype': 'transfer function B/A in format (Y)', 'type_name': 'TF', 'xfer': array([[ 2.0319992e-03+0.0000000e+00j, 1.5529208e-03+1.4785477e-03j, 9.0984150e-04+1.8886093e-03j, ..., 1.1092599e+27-2.3797619e+08j, 5.5111208e-08-2.0454582e-04j, -4.4841594e-35-4.2907759e-42j]], dtype=complex64)}
-
get_results
(type_name)¶ Return the results of a particular type from the diaggui XML file.
- Parameters
type_name (string) – The type of results. ‘TF’, ‘COH’, ‘CSD’, or ‘PSD’.
- Returns
A dictionary with all the results with key being the channelA string.
- Return type
dict
-
measure
()¶ Measure new results using the diaggui XML file.
-
psd
(channel_a, datatype='results')¶ Read power spectral density from diaggui file
- Parameters
channel_a (string) – The channel name of the PSD to be read.
- Returns
f (array) – The frequency axis of the PSD.
psddata (array) – The power spectral density.
Notes
The PSD in diaggui is actually amplitude spectral density (ASD), not PSD.
-
tf
(channel_a, channel_b, datatype='results')¶ Derive transfer function from CSD and PSD from diaggui file.
- Parameters
channel_a (string) – The input channel string.
channel_b (string) – The output channel string.
- Returns
f (array) – The frequency axis of the transfer function.
tfdata (array) – The transfer function, defined by B/A, in complex numbers.