def _get_info_from_file(filename):
    """
    Extracts measurement information for a given guided wave measurement file from its filename.
    Parameters
    ----------
    filename : str
        Filename of the guided wave measurement.
    """
    # if fullpath is provided, extract the filename only
    filename = basename(filename)

    osc = int(filename[3])

    ind = filename.lower().find('khz')
    frequency = int(filename[5:ind])
    actuator = filename[ind + 3:ind + 5]

    impact_energy = float(filename[ind + 5:ind + 9])
    parts = filename.split('_')
    impact_num = int(parts[1][0]) - 1 if len(parts) == 2 else 0

    impact_idx = conf['experiment']['impact_energy'].index(
        impact_energy) + impact_num

    ind = -filename[::-1].index('V')
    parts = filename[ind:].split('.')
    temperature_ind = int(parts[0]) if parts[0] else 0

    if frequency != 100 or actuator != '2T':
        return None, None

    return osc, scihdf.Info(sensor=None,
                            impact=impact_idx,
                            index=temperature_ind)
Exemplo n.º 2
0
def read_form_filename(filename):
    """
    Extract measurement information for a given laser measurement from its filename.

    Parameters
    ----------
    filename : str
        Filename of the laser measurement.

    Returns
    -------
    info : dict
        A dictionary containing the laser measurement parameters.
    """
    # if fullpath is provided, extract the filename only
    filename = basename(filename)

    impact_energy = float(filename[:4])
    parts = filename.split('_')

    if len(parts) == 2:
        impact_num = 0
    elif len(parts) == 3:
        impact_num = int(parts[1][0]) - 1
    else:
        raise ValueError('The filename provided does not follow required naming convention.')

    impact_idx = conf['guided_waves']['experiment']['impact_energy'].index(impact_energy) + \
                 impact_num
    return scihdf.Info(impact=impact_idx)
""" Show how we segment the signals into different bins."""
from packages import utkit, scihdf, utils
from matplotlib import pyplot
from os.path import join
import numpy as np
from matplotlib.ticker import FormatStrFormatter

pyplot.style.use('plot_styles.mplstyle')
conf = utils.Configurations()['guided_waves']

store = scihdf.SciHDF(conf['data']['rx_dump'])
info = scihdf.Info(sensor='5T', index=0, impact=0)

pw = conf['features']['complex_amp']['pw']
holdoff = conf['features']['complex_amp']['holdoff']

wave = utkit.Signal(store[info]).remove_mean()
store.close()

# make the figure
fig, ax = pyplot.subplots(2, 1, figsize=(3.4, 4), dpi=100)
ax[0].plot(wave.index * 1e6, wave)

i = 0
clrs = ['#020202', '#808080']
xticks = []
while holdoff + pw <= wave.index[-1]:
    wave_windowed = wave.window(index1=holdoff,
                                index2=holdoff + pw,
                                win_fcn='hann')
    p1, = ax[1].plot(wave_windowed.index * 1e6,
Exemplo n.º 4
0
"""
Compute the pulse width of the excitation signal. This is useful to find out the required
parameters for the spectrogram.
"""
from packages import utkit, utils, scihdf

conf = utils.get_configuration()['guided_waves']

info = scihdf.Info(actuator='2T',
                   sensor='5B',
                   impact=0,
                   index=0,
                   frequency=100)

print('Pulse width: ', utils.compute_pw(info) * 1e6, 'microsecond')