add more requests

This commit is contained in:
2023-06-02 08:53:44 +02:00
parent 4fe2c5f9fa
commit a27c94eb7c
10 changed files with 220 additions and 109 deletions

View File

@@ -13,6 +13,45 @@ from paveit.labtest import DataSineLoad
class CITTBase(DataSineLoad):
def _set_parameter(self):
self._logger.debug('run _set_parameter')
self.split_data_based_on_parameter = ['T', 'sigma', 'f']
self.col_as_int = ['N']
self.col_as_float = [
'T', 'F', 's_piston', 's_hor_1', 'f', 's_hor_1', 's_hor_2'
]
self.val_col_names = [
'time', 'T', 'f', 'sigma', 'N', 'F', 's_hor_1', 's_hor_2', 's_piston'
]
self.columns_analyse = [
'F', 's_hor_sum', 's_hor_1', 's_hor_2', 's_piston'
]
self.round_values = [('T', 3), ('sigma', 3)]
# Header names after standardization; check if exists
self.val_header_names = ['speciment_height', 'speciment_diameter']
self.number_of_load_cycles_for_analysis = 5
#Dummy Data, replace in Machine Config
self.meta_names_of_parameter = {
'sigma': ['Max. Spannung']
} #list of names
#Dummy Data, replace in Machine Config
self.data_column_names = {
'time': ['Time Series'],
'F': ['Load Series'],
's_hor_1': ['LVDT1 Series'],
's_hor_2': ['LVDT2 Series'],
}
def _sel_df(self, df, num=5, shift=-1):
@@ -117,8 +156,10 @@ class CITTBase(DataSineLoad):
if data is None: continue
if len(data) < 10: continue
try:
self._logger.debug(f'run fit on subset {idx_data}')
data.index = data.index - data.index[0]
@@ -200,8 +241,11 @@ class CITTBase(DataSineLoad):
# TODO: Überarbeiten und erweitern (ISSUE #2)
res_temp['phase'] = res_temp['fit_F_phase'] - res_temp[
'fit_s_hor_sum_phase']
except:
except Exception as e:
self._logger.exception(e)
res_temp = None
self._logger.debug(res_temp)
self.fit.append(res_temp)
@@ -266,54 +310,90 @@ class CITTBase(DataSineLoad):
s_hor_2=list(data['s_hor_2']),
s_hor_sum=list(data['s_hor_sum']),
)
self._logger.debug(f'columns data, {data.columns}')
# add optional datas
for col in ['s_piston']:
if col in data.columns:
self._logger.debug(f'add {col} to output data')
data_out[col] = list(data[col])
outkeys = list(data_out.keys())
self._logger.debug(f'write raw data to db, {outkeys}')
g = CITTSiffness(result=f.id, **data_out).save()
class CITT_TUDresden(CITTBase):
def _which_machine(self):
"""
check the file and try to get the machine from the data
"""
self._machine = 'TIRA'
class CITT_TUDresdenWille(CITTBase):
def _define_units(self):
if self._machine == 'TIRA':
self.unit_s = 1 #mm
self.unit_F = 1. #N
self.unit_t = 1. #s
self.unit_s = 1 / 1000. #mm
self.unit_F = 1.0 #N
self.unit_t = 1. #s
def update_parameter(self):
if self._machine == 'TIRA':
self.meta_names_of_parameter = {
'sigma': ['Oberspannung'],
'f': ['Prüffrequenz'],
'T': ['Prüftemperatur'],
't': ['Zeit'],
'speciment_diameter': ['Probekörberdurchmesser', 'Probekörberbreite'],
'speciment_height': ['Probekörperhöhe'],
} #list of names
self.meta_names_of_parameter = {
'sigma': ['Oberspannung'],
'f': ['Sollfrequnz'],
'T': ['Solltemperatur'],
#'Nfrom': ['Erster Aufzeichnungslastwechsel', 'Start Cycle'],
#'Nto': ['Letzer Aufzeichnungslastwechsel', 'Last Cycle'],
't': ['Zeit'],
'speciment_diameter': ['PK-Durchmesser'],
'speciment_height': ['PK-Höhe'],
} #list of names
self.data_column_names = {
'time': ['Zeit'],
'F': ['Kraft'],
'N': ['Zyklenzähler'],
's_hor_1': ['Horizontalweg vorn', 'Weg Probe'],
's_hor_2': ['Horizontalweg hinten', 'Weg 2'],
's_piston': ['Kolbenweg'],
}
self.data_column_names = {
'time': ['Zeit'],
'F': ['Kraft'],
'N': ['Lastwechsel'],
's_hor_1': ['IWA_1 2 mm'],
's_hor_2': ['IWA_2 2 mm'],
's_piston': ['Kolbenweg'],
}
def _process_data(self):
meta, data = read_geosys(self.data, '039', metadata_ids=['001','003', '011', '019'])
#define in class
self.data = data.reset_index()
self.metadata.update(meta)
# log infos
self._logger.debug(f'metadata: {self.metadata}')
self._logger.debug(f'data: {self.data.head()}')
print(data.head())
class CITT_TUDresdenTira(CITTBase):
def _define_units(self):
self.unit_s = 1 #mm
self.unit_F = 1. #N
self.unit_t = 1. #s
def update_parameter(self):
self.meta_names_of_parameter = {
'sigma': ['Oberspannung'],
'f': ['Sollfrequnz'],
'T': ['Solltemperatur'],
#'Nfrom': ['Erster Aufzeichnungslastwechsel', 'Start Cycle'],
#'Nto': ['Letzer Aufzeichnungslastwechsel', 'Last Cycle'],
't': ['Zeit'],
'speciment_diameter': ['PK-Durchmesser', 'Probekörberbreite'],
'speciment_height': ['PK-Höhe', 'Probekörperhöhe'],
} #list of names
self.data_column_names = {
'time': ['Zeit'],
'F': ['Kraft'],
'N': ['Lastwechsel'],
's_hor_1': ['IWA_1 2 mm'],
's_hor_2': ['IWA_2 2 mm'],
's_piston': ['Kolbenweg'],
}
def _process_data(self):
@@ -396,6 +476,7 @@ class CITT_TUDresden(CITTBase):
self._logger.info(self.data.head())
class CITT_PTMDortmund(CITTBase):
def _define_units(self):