Skip to content
Snippets Groups Projects
Commit 782251cb authored by Eduard Friske's avatar Eduard Friske
Browse files
parents 6f352ba8 df6851a5
Branches
Tags v0.3.0
No related merge requests found
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Created on Wed Jul 5 09:51:18 2023 Created on Wed Jul 5 09:51:18 2023
@author: becker07 @author: becker07
""" """
#!/usr/bin/env python #!/usr/bin/env python
import os import os
import time import time
import datetime import datetime
import elabapi_python import elabapi_python
from elabapi_python.rest import ApiException from elabapi_python.rest import ApiException
import requests import requests
import json import json
import couchdb import couchdb
import numpy as np import numpy as np
from urllib3.exceptions import InsecureRequestWarning from urllib3.exceptions import InsecureRequestWarning
from urllib3 import disable_warnings from urllib3 import disable_warnings
couch = couchdb.Server('http://a73434.berlin.ptb.de:5984') couch = couchdb.Server('http://a73434.berlin.ptb.de:5984')
db = couch['vl_db'] # existing db = couch['vl_db'] # existing
######################### #########################
# CONFIG # # CONFIG #
######################### #########################
API_HOST_URL = 'https://elabftw.ptb.de/api/v2' API_HOST_URL = 'https://elabftw.ptb.de/api/v2'
# replace with your api key # replace with your api key
API_KEY = 'a2c6b77fdd5b19b35b3043dbfd5ac73883c4265ab210a3672037ace64a6207cfa4231a0a834ed30c19be8' API_KEY = 'a2c6b77fdd5b19b35b3043dbfd5ac73883c4265ab210a3672037ace64a6207cfa4231a0a834ed30c19be8'
# number of days to look back # number of days to look back
######################### #########################
# END CONFIG # # END CONFIG #
######################### #########################
# Configure the api client # Configure the api client
configuration = elabapi_python.Configuration() configuration = elabapi_python.Configuration()
configuration.api_key['api_key'] = API_KEY configuration.api_key['api_key'] = API_KEY
configuration.api_key_prefix['api_key'] = 'Authorization' configuration.api_key_prefix['api_key'] = 'Authorization'
configuration.host = API_HOST_URL configuration.host = API_HOST_URL
configuration.debug = False configuration.debug = False
configuration.verify_ssl = True configuration.verify_ssl = True
# create an instance of the API class # create an instance of the API class
api_client = elabapi_python.ApiClient(configuration) api_client = elabapi_python.ApiClient(configuration)
# fix issue with Authorization header not being properly set by the generated lib # fix issue with Authorization header not being properly set by the generated lib
api_client.set_default_header(header_name='Authorization', header_value=API_KEY) api_client.set_default_header(header_name='Authorization', header_value=API_KEY)
# create an instance of Experiments # create an instance of Experiments
experimentsApi = elabapi_python.ExperimentsApi(api_client) experimentsApi = elabapi_python.ExperimentsApi(api_client)
uploadsApi = elabapi_python.UploadsApi(api_client) uploadsApi = elabapi_python.UploadsApi(api_client)
# create an instance of Tags # create an instance of Tags
api_instance = elabapi_python.TagsApi(api_client) api_instance = elabapi_python.TagsApi(api_client)
# calculate the date # calculate the date
today = datetime.date.today() today = datetime.date.today()
######## ########
elab_id=640 elab_id=643
cers = ["75562_0001","75563_0001","75564_0001","75565_0001","75566_0001","75567_0001","75568_0001","75569_0001","75570_0001","75571_0001","75572_0001","75573_0001"] # Beispiel: cers = ["75511_0001","75512_0001"] cers = ["75552_0001","75553_0001"] # Beispiel: cers = ["75511_0001","75512_0001"]
TL1_2= "FM1" #### FM1 oder TLA TL1_2= "TLA" #### FM1 oder TLA
year = "2024" year = "2024"
kk= "KK" kk= "KK"
commentar = '' commentar = ''
################################ ################################
# get experiment with ID xxxx # get experiment with ID xxxx
exp = experimentsApi.get_experiment(elab_id) exp = experimentsApi.get_experiment(elab_id)
print('='*72) print('='*72)
print('\n ******** Experiment {} (Original): \n'.format(elab_id), exp) print('\n ******** Experiment {} (Original): \n'.format(elab_id), exp)
print('\n ******** Experiment-Body ', exp.body) print('\n ******** Experiment-Body ', exp.body)
print('\n ******** Experiment-Tags ', exp.userid) print('\n ******** Experiment-Tags ', exp.userid)
print('='*72) print('='*72)
################################# #################################
if kk == "KK": if kk == "KK":
type_k = "-kk-" type_k = "-kk-"
tag_type = "KK" tag_type = "KK"
################################# #################################
if TL1_2 == "TLA": if TL1_2 == "TLA":
tl="-tl2" tl="-tl2"
json_file = "cal-" + year + tl + type_k + cers[0] json_file = "cal-" + year + tl + type_k + cers[0]
print(json_file) print(json_file)
doc = db.get(json_file) doc = db.get(json_file)
STD1 ="TLA" STD1 ="TLA"
STD2 ="TL2" STD2 ="TL2"
tab_begin=' </p><table style="border-collapse:collapse;width:100%;height:100%;"><tr style="height:16px;"><td style="width:33.3222%;height:16px;">DB-Link</td><td style="width:33.3222%;height:16px;">p-upstream</td><td style="width:33.3222%;height:16px;">Gas</td></tr>' tab_begin=' </p><table style="border-collapse:collapse;width:100%;height:100%;"><tr style="height:16px;"><td style="width:33.3222%;height:16px;">DB-Link</td><td style="width:33.3222%;height:16px;">p-upstream</td><td style="width:33.3222%;height:16px;">Gas</td></tr>'
else : else :
tl="-fm1" tl="-fm1"
json_file = "cal-" + year + tl + type_k + cers[0] json_file = "cal-" + year + tl + type_k + cers[0]
print(json_file) print(json_file)
doc = db.get(json_file) doc = db.get(json_file)
Type_k =(doc["Calibration"]["Type"]) Type_k =(doc["Calibration"]["Type"])
STD1 ="TLV" STD1 ="TLV"
STD2 ="FM1" STD2 ="FM1"
tab_begin=' </p><table style="border-collapse:collapse;width:100%;height:100%;"><tr style="height:16px;"><td style="width:33.3222%;height:16px;">DB-Link</td><td style="width:33.3222%;height:16px;">Ventil</td><td style="width:33.3222%;height:16px;">Gas</td></tr>' tab_begin=' </p><table style="border-collapse:collapse;width:100%;height:100%;"><tr style="height:16px;"><td style="width:33.3222%;height:16px;">DB-Link</td><td style="width:33.3222%;height:16px;">Ventil</td><td style="width:33.3222%;height:16px;">Gas</td></tr>'
# Die Überschrift wird zusammengesetzt # Die Überschrift wird zusammengesetzt
title1=doc["Calibration"]["Customer"]["Sign"] title1=doc["Calibration"]["Customer"]["Sign"]
body_title = STD1 + ' / ' + STD2 + ' Kalibrierung [' + title1 + ']' body_title = STD1 + ' / ' + STD2 + ' Kalibrierung [' + title1 + ']'
# Die Tabelle wird zusammengesetzt # Die Tabelle wird zusammengesetzt
body_begin='<p> ' body_begin='<p> '
#tab_begin=' </p><table style="border-collapse:collapse;width:100%;height:100%;"><tr style="height:16px;"><td style="width:33.3222%;height:16px;">DB-Link</td><td style="width:33.3222%;height:16px;">p-upstream</td><td style="width:33.3222%;height:16px;">Gas</td></tr>' #tab_begin=' </p><table style="border-collapse:collapse;width:100%;height:100%;"><tr style="height:16px;"><td style="width:33.3222%;height:16px;">DB-Link</td><td style="width:33.3222%;height:16px;">p-upstream</td><td style="width:33.3222%;height:16px;">Gas</td></tr>'
text1='<tr style="height:16px;"><td style="width:33.3222%;height:16px;"><a href="http://a73434.berlin.ptb.de:5984/_utils/#database/vl_db/' text1='<tr style="height:16px;"><td style="width:33.3222%;height:16px;"><a href="http://a73434.berlin.ptb.de:5984/_utils/#database/vl_db/'
text1_1='tl2' text1_1='tl2'
text1_2='-' text1_2='-'
text1_3='kk' text1_3='kk'
text1_4='-' text1_4='-'
text2='" target="_blank" rel="noreferrer noopener">cal-' text2='" target="_blank" rel="noreferrer noopener">cal-'
text3='</a></td><td style="width:33.3222%;height:16px;">' text3='</a></td><td style="width:33.3222%;height:16px;">'
text4='</td><td style="width:33.3222%;height:16px;">' text4='</td><td style="width:33.3222%;height:16px;">'
text5='</td></tr>' text5='</td></tr>'
tab_end='</table><p> </p><p> </p>' tab_end='</table><p> </p><p> </p>'
# Die Tags werden zusammengesetzt # Die Tags werden zusammengesetzt
json_file_tag = "cal-" + year + tl + type_k + cers[0] json_file_tag = "cal-" + year + tl + type_k + cers[0]
doc_tag = db.get(json_file_tag) doc_tag = db.get(json_file_tag)
ReferenceNo =doc_tag["Calibration"]["Presettings"]["CommonReferenceNo"] ReferenceNo =doc_tag["Calibration"]["Presettings"]["CommonReferenceNo"]
print('stopp') print('stopp')
Type_k =(doc_tag["Calibration"]["Type"]) Type_k =(doc_tag["Calibration"]["Type"])
CustomerSign =(doc_tag["Calibration"]["Customer"]["Sign"]) print(Type_k)
CustomerSign =(doc_tag["Calibration"]["Customer"]["Sign"])
len_cers=len(cers)
len_cers=len(cers)
val = ""
size = len_cers val = ""
tab_body = [val] * size size = len_cers
p_up = [val] * size tab_body = [val] * size
gas = [val] * size p_up = [val] * size
vent = [val] * size gas = [val] * size
print('111111111', tab_body) vent = [val] * size
print('111111111', tab_body)
if TL1_2 == 'TLA':
if TL1_2 == 'TLA':
i = 0
while i < len(cers): i = 0
json_file = "cal-" + year + tl + type_k + cers[i] while i < len(cers):
print(json_file) json_file = "cal-" + year + tl + type_k + cers[i]
doc = db.get(json_file) print(json_file)
p_up[i]=doc["Calibration"]["Result"]["Formula"]["PressureUpstream"] doc = db.get(json_file)
gas[i]=doc["Calibration"]["ToDo"]["Gas"] p_up[i]=doc["Calibration"]["Result"]["Formula"]["PressureUpstream"]
body=text1 + json_file + text2+ year +tl + type_k + cers[i]+ text3 + p_up[i] + text4 + gas[i] + text5 gas[i]=doc["Calibration"]["ToDo"]["Gas"]
tab_body[i] = body body=text1 + json_file + text2+ year +tl + type_k + cers[i]+ text3 + p_up[i] + text4 + gas[i] + text5
p_up[i]=np.array(doc["Calibration"]["Result"]["Formula"]["PressureUpstream"]) tab_body[i] = body
p_up[i]=np.array(doc["Calibration"]["Result"]["Formula"]["PressureUpstream"])
i += 1
else : i += 1
i = 0 else :
while i < len(cers): i = 0
json_file = "cal-" + year + tl + type_k + cers[i] while i < len(cers):
print(json_file) json_file = "cal-" + year + tl + type_k + cers[i]
x = cers[i][:5] print(json_file)
doc = db.get(json_file) x = cers[i][:5]
name_plot= "Scan_" + x + ".pdf" doc = db.get(json_file)
file_plot= 'C:/Users/becker07/python/TL1/' + name_plot name_plot= "Scan_" + x + ".pdf"
name_Scan_json= "Scan" + x + ".pdf" file_plot= 'C:/Users/becker07/python/TL1/' + name_plot
file_json= 'C:/Users/becker07/python/TL1/' + name_Scan_json name_Scan_json= "Scan" + x + ".pdf"
attachment = db.get_attachment(doc, "Scan.pdf").read() file_json= 'C:/Users/becker07/python/TL1/' + name_Scan_json
with open(file_json, 'wb') as pdf_object: attachment = db.get_attachment(doc, "Scan.pdf").read()
pdf_object.write(attachment) with open(file_json, 'wb') as pdf_object:
uploadsApi.post_upload('experiments', elab_id, file=file_json, comment='Plot: Signal und Offset vom Leck') pdf_object.write(attachment)
os.remove(file_json) uploadsApi.post_upload('experiments', elab_id, file=file_json, comment='Plot: Signal und Offset vom Leck')
gas[i]=doc["Calibration"]["ToDo"]["Gas"] os.remove(file_json)
vent[i]=doc["Calibration"]["Result"]["Formula"]["Valve"] gas[i]=doc["Calibration"]["ToDo"]["Gas"]
body=text1 + json_file + text2 + year + tl + type_k + cers[i]+ text3 + vent[i] + text4 + gas[i] + text5 vent[i]=doc["Calibration"]["Result"]["Formula"]["Valve"]
tab_body[i] = body body=text1 + json_file + text2 + year + tl + type_k + cers[i]+ text3 + vent[i] + text4 + gas[i] + text5
i += 1 tab_body[i] = body
i += 1
text_all= ''.join(tab_body)
text_all= ''.join(tab_body)
body_tab=body_begin + commentar + tab_begin + text_all + tab_end
body_tab=body_begin + commentar + tab_begin + text_all + tab_end
now = datetime.datetime.now()
now = datetime.datetime.now()
#new_body='<p>Neu von UteXX x({})</p>'.format(now.strftime('%Y-%m-%d %H:%M:%S'))
#new_body='<p>Neu von UteXX x({})</p>'.format(now.strftime('%Y-%m-%d %H:%M:%S'))
data_body = { 'body': body_tab}
data_title = {'title': body_title} data_body = { 'body': body_tab}
data_title = {'title': body_title}
print('elab_id= ', elab_id)
print('elab_id= ', elab_id)
# === Modifizieren der Einträge (hier Eintrag "body") ===
response_body = experimentsApi.patch_experiment(elab_id, body=data_body) # === Modifizieren der Einträge (hier Eintrag "body") ===
response_title = experimentsApi.patch_experiment(elab_id, body=data_title) response_body = experimentsApi.patch_experiment(elab_id, body=data_body)
data_tag={ 'tag': ReferenceNo} response_title = experimentsApi.patch_experiment(elab_id, body=data_title)
response_tag = api_instance.post_tag('experiments', elab_id, body=data_tag) data_tag={ 'tag': ReferenceNo}
data_tag={ 'tag': Type_k} response_tag = api_instance.post_tag('experiments', elab_id, body=data_tag)
response_tag = api_instance.post_tag('experiments', elab_id, body=data_tag) data_tag={ 'tag': Type_k}
data_tag={ 'tag': STD1} response_tag = api_instance.post_tag('experiments', elab_id, body=data_tag)
response_tag = api_instance.post_tag('experiments', elab_id, body=data_tag) data_tag={ 'tag': STD1}
data_tag={ 'tag': STD2} response_tag = api_instance.post_tag('experiments', elab_id, body=data_tag)
response_tag = api_instance.post_tag('experiments', elab_id, body=data_tag) data_tag={ 'tag': STD2}
data_tag={ 'tag': CustomerSign} response_tag = api_instance.post_tag('experiments', elab_id, body=data_tag)
response_tag = api_instance.post_tag('experiments', elab_id, body=data_tag) data_tag={ 'tag': CustomerSign}
#response = experimentsApi.patch_experiment(elab_id, tags=new_tags) response_tag = api_instance.post_tag('experiments', elab_id, body=data_tag)
print('='*72) #response = experimentsApi.patch_experiment(elab_id, tags=new_tags)
# === der modifizierte Zustand === print('='*72)
print('\n******** Experiment {} (modifiziert): \n'.format(elab_id), response_body) # === der modifizierte Zustand ===
print('='*72) print('\n******** Experiment {} (modifiziert): \n'.format(elab_id), response_body)
print('='*72)
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Created on Fri Jan 6 11:14:44 2023 Created on Fri Jan 6 11:14:44 2023
@author: becker07 @author: becker07
""" """
import pathlib import pathlib
import os import os
import couchdb import couchdb
couch = couchdb.Server('http://a73434.berlin.ptb.de:5984') couch = couchdb.Server('http://a73434.berlin.ptb.de:5984')
db = couch['vl_db'] # existing db = couch['vl_db'] # existing
year = "2024" year = "2024"
cers = ["75564","75565","75566","75567","75568","75569","75570","75571","75572","75573"] # Beispiel: cers = ["75511_0001","75512_0001"] cers = ["75552","75553"] # Beispiel: cers = ["75511_0001","75512_0001"]
#cers = ["75562","75563"] # Beispiel: cers = ["75511_0001","75512_0001"] #cers = ["75562","75563"] # Beispiel: cers = ["75511_0001","75512_0001"]
################### die Kalibrierscheine werden an das cer-json-dokument angehangen ################## ################### die Kalibrierscheine werden an das cer-json-dokument angehangen ##################
i = 0 i = 0
while i < len(cers): while i < len(cers):
json_file = "cer-" + year + '-' + cers[i] json_file = "cer-" + year + '-' + cers[i]
print(json_file) print(json_file)
doc = db.get(json_file) doc = db.get(json_file)
cer_pdf= "ks-" +cers[i] + "-" + year + ".pdf" cer_pdf= "ks-" +cers[i] + "-" + year + ".pdf"
cer_tex= "ks-" +cers[i] + "-" + year + ".tex" cer_tex= "ks-" +cers[i] + "-" + year + ".tex"
print(cer_pdf, cer_tex) print(cer_pdf, cer_tex)
ks_pdf = "C:\\Users\\becker07\\kalibrierschein\\" + cer_pdf ks_pdf = "C:\\Users\\becker07\\kalibrierschein\\" + cer_pdf
ks_tex = "C:\\Users\\becker07\\kalibrierschein\\" + cer_tex ks_tex = "C:\\Users\\becker07\\kalibrierschein\\" + cer_tex
print(ks_pdf, ks_tex) print(ks_pdf, ks_tex)
content_pdf=pathlib.Path(ks_pdf).read_bytes() content_pdf=pathlib.Path(ks_pdf).read_bytes()
content_tex=pathlib.Path(ks_tex).read_bytes() content_tex=pathlib.Path(ks_tex).read_bytes()
db.put_attachment(doc, content_pdf, cer_pdf , content_type='application/pdf') db.put_attachment(doc, content_pdf, cer_pdf , content_type='application/pdf')
db.put_attachment(doc, content_tex, cer_tex , content_type='text/plain') db.put_attachment(doc, content_tex, cer_tex , content_type='text/plain')
i += 1 i += 1
################### die Kalibrierscheine werden im Ordner Kalibrierscheine gelöscht ################## ################### die Kalibrierscheine werden im Ordner Kalibrierscheine gelöscht ##################
i = 0 i = 0
while i < len(cers): while i < len(cers):
json_file = "cer-" + year + '-' + cers[i] json_file = "cer-" + year + '-' + cers[i]
print(json_file) print(json_file)
doc = db.get(json_file) doc = db.get(json_file)
cer_pdf= "ks-" +cers[i] + "-" + year + ".pdf" cer_pdf= "ks-" +cers[i] + "-" + year + ".pdf"
cer_tex= "ks-" +cers[i] + "-" + year + ".tex" cer_tex= "ks-" +cers[i] + "-" + year + ".tex"
cer_aux= "ks-" +cers[i] + "-" + year + ".aux" cer_aux= "ks-" +cers[i] + "-" + year + ".aux"
cer_log= "ks-" +cers[i] + "-" + year + ".log" cer_log= "ks-" +cers[i] + "-" + year + ".log"
cer_gz= "ks-" +cers[i] + "-" + year + ".synctex.gz" cer_gz= "ks-" +cers[i] + "-" + year + ".synctex.gz"
print(cer_pdf, cer_tex) print(cer_pdf, cer_tex)
ks_pdf = "C:\\Users\\becker07\\kalibrierschein\\" + cer_pdf ks_pdf = "C:\\Users\\becker07\\kalibrierschein\\" + cer_pdf
ks_tex = "C:\\Users\\becker07\\kalibrierschein\\" + cer_tex ks_tex = "C:\\Users\\becker07\\kalibrierschein\\" + cer_tex
ks_aux = "C:\\Users\\becker07\\kalibrierschein\\" + cer_aux ks_aux = "C:\\Users\\becker07\\kalibrierschein\\" + cer_aux
ks_log = "C:\\Users\\becker07\\kalibrierschein\\" + cer_log ks_log = "C:\\Users\\becker07\\kalibrierschein\\" + cer_log
ks_gz = "C:\\Users\\becker07\\kalibrierschein\\" + cer_gz ks_gz = "C:\\Users\\becker07\\kalibrierschein\\" + cer_gz
print(ks_pdf, ks_tex) print(ks_pdf, ks_tex)
os.remove(ks_pdf) os.remove(ks_pdf)
os.remove(ks_tex) os.remove(ks_tex)
os.remove(ks_aux) os.remove(ks_aux)
os.remove(ks_log) os.remove(ks_log)
os.remove(ks_gz) os.remove(ks_gz)
i += 1 i += 1
\ No newline at end of file
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Created on Fri Jul 1 12:12:37 2022 Created on Fri Jul 1 12:12:37 2022
@author: becker07 @author: becker07
""" """
from matplotlib import pyplot as plt from matplotlib import pyplot as plt
from statistics import mean from statistics import mean
from datetime import datetime from datetime import datetime
#from IPython.display import Markdown as md from IPython.display import Markdown as md
import numpy as np import numpy as np
import math import math
import statistics import statistics
import pandas as pd import pandas as pd
import json import json
import couchdb import couchdb
from pathlib import Path couch = couchdb.Server('http://a73434.berlin.ptb.de:5984')
couch = couchdb.Server('http://a73434.berlin.ptb.de:5984') db = couch['vl_db'] # existing
db = couch['vl_db'] # existing
## Eingabe von:
## Eingabe von: # - Kalibrierscheinnummer
# - Kalibrierscheinnummer # - Jahr der Kalibrierung
# - Jahr der Kalibrierung # - laufende Nummer der Kalibrierung
# - laufende Nummer der Kalibrierung
cal_cert = "75556"
cal_cert = "75553" year = "2024"
year = "2024" no = "0001"
no = "0001"
pfad = Path("P:\TLA\Messdaten") json_file = "cal-" + year + "-tl2-kk-" + cal_cert + "_" + no
print(pfad) doc = db.get(json_file)
#exit()
# Die Daten aus dem File mit der entsprechenden Kalibrierscheinnummer werden eingelesen:
json_file = "cal-" + year + "-tl2-kk-" + cal_cert + "_" + no # datum, time, p_up und alle Temperaturen,
doc = db.get(json_file) path='C:\\Users\\becker07\\python\\TL2\\'
datei = path + cal_cert + "PTB" + year
# Die Daten aus dem File mit der entsprechenden Kalibrierscheinnummer werden eingelesen: datei_S = path + cal_cert + "PTB" + year + "_S"
# datum, time, p_up und alle Temperaturen, print(json_file)
datei = cal_cert + "PTB" + year datei_pkt = pd.read_csv(datei, sep="\t", decimal = ',' )
datei_S = cal_cert + "PTB" + year + "_S" datei_S_pkt = pd.read_csv(datei_S, sep="\t", decimal = ',' )
print(json_file) datum=datei_pkt["Datum"]
time=datei_pkt["Zeit"]
datei_pkt = pd.read_csv(pfad.joinpath(datei), sep="\t", decimal = ',' ) p_up=datei_pkt["Druck"]
datei_S_pkt = pd.read_csv(pfad.joinpath(datei_S), sep="\t", decimal = ',' )
datum=datei_pkt["Datum"] p_up=np.array(p_up)
time=datei_pkt["Zeit"] p_up = np.asarray(p_up, dtype=float)
p_up=datei_pkt["Druck"]
q_tab=datei_pkt["q_mol"]
p_up=np.array(p_up) T_room=datei_pkt["Raumtemperatur"]
p_up = np.asarray(p_up, dtype=float) T_h2o=datei_pkt["T-H2O"]
T_wv=datei_pkt["T-WV"]
q_tab=datei_pkt["q_mol"] T_tl=datei_pkt["T-TL"]
T_room=datei_pkt["Raumtemperatur"] T_rv=datei_pkt["T-RV"]
T_h2o=datei_pkt["T-H2O"] p_atm=datei_pkt["Umgebungsdruck p_0"]*100 # Umrechnung in Pa
T_wv=datei_pkt["T-WV"]
T_tl=datei_pkt["T-TL"]
T_rv=datei_pkt["T-RV"] m1_drift = datei_pkt["m1_D"]
p_atm=datei_pkt["Umgebungsdruck p_0"]*100 # Umrechnung in Pa m2_drift = datei_pkt["m2_D"]
m_sz = datei_pkt["m-SZ"] print(p_atm)
m1_drift = datei_pkt["m1_D"] # Die Werte der Sägezähne befinden sich im File "Kalibrierscheinnummer_S".
m2_drift = datei_pkt["m2_D"] # Da pro Messpunkt 2 Sägezähne gefahren werden, existieren auch für jeden Messpunkt
print(p_atm) # jeweils zwei Zeiten t_i und zwei Hübe l_1
# Die Werte der Sägezähne befinden sich im File "Kalibrierscheinnummer_S".
# Da pro Messpunkt 2 Sägezähne gefahren werden, existieren auch für jeden Messpunkt l_1=datei_S_pkt["pos1_i"]
# jeweils zwei Zeiten t_i und zwei Hübe l_1 l_2=datei_S_pkt["pos2_i"]
l_pos= l_1-l_2
l_1=datei_S_pkt["pos1_i"] l_i=datei_S_pkt["h_i"]
l_2=datei_S_pkt["pos2_i"] t_i=datei_S_pkt["t_i"]
l_pos= l_1-l_2 m_sz_i =datei_S_pkt["m_i"]
l_i=datei_S_pkt["h_i"]
t_i=datei_S_pkt["t_i"]
# Im File Datei_S sind die einzelnen Hübe l_i der Nadel in einer Spalte gespeichert, der Hub l
# Im File Datei_S sind die einzelnen Hübe l_i der Nadel in einer Spalte gespeichert, der Hub l # muss daher in Hub l_1 und l_2 aufgegliedert werden, da in der Regel 2 Sägezähne gefahren werden.
# muss daher in Hub l_1 und l_2 aufgegliedert werden, da in der Regel 2 Sägezähne gefahren werden. l_1=l_pos[0::2] # Begonnen wird in der Spalte beim Element 0 bis zum Ende der Spalte in zweier Schritte
l_1=l_pos[0::2] # Begonnen wird in der Spalte beim Element 0 bis zum Ende der Spalte in zweier Schritte l_2=l_pos[1::2] # Begonnen wird in der Spalte beim Element 1 bis zum Ende der Spalte in zweier Schritte
l_2=l_pos[1::2] # Begonnen wird in der Spalte beim Element 1 bis zum Ende der Spalte in zweier Schritte
#l_1=np.genfromtxt(datei_S,skip_header=1,usecols=(2)) #### wenn nur 1 SZ vorhanden
#l_1=np.genfromtxt(datei_S,skip_header=1,usecols=(2)) #### wenn nur 1 SZ vorhanden
# Das gleiche gilt für die Zeit t_i
t_1=t_i[0::2] # Begonnen wird in der Spalte beim Element 0 bis zum Ende der Spalte in zweier Schritte
# Das gleiche gilt für die Zeit t_i t_2=t_i[1::2] # Begonnen wird in der Spalte beim Element 1 bis zum Ende der Spalte in zweier Schritte
t_1=t_i[0::2] # Begonnen wird in der Spalte beim Element 0 bis zum Ende der Spalte in zweier Schritte #t_1=np.genfromtxt(datei_S,skip_header=1,usecols=(3))#### wenn nur 1 SZ vorhanden
t_2=t_i[1::2] # Begonnen wird in der Spalte beim Element 1 bis zum Ende der Spalte in zweier Schritte
#t_1=np.genfromtxt(datei_S,skip_header=1,usecols=(3))#### wenn nur 1 SZ vorhanden
# Das gleiche gilt für den SZ m_sz__i
# Temperatur m_sz_1=m_sz_i[0::2] # Begonnen wird in der Spalte beim Element 0 bis zum Ende der Spalte in zweier Schritte
lis_T_h2o = T_h2o.tolist() m_sz_2=m_sz_i[1::2] # Begonnen wird in der Spalte beim Element 1 bis zum Ende der Spalte in zweier Schritte
lis_T_room = T_room.tolist()
lis_T_tl = T_tl.tolist() # Temperatur
lis_T_wv = T_wv.tolist() lis_T_h2o = T_h2o.tolist()
lis_T_rv = T_rv.tolist() lis_T_room = T_room.tolist()
# Druck lis_T_tl = T_tl.tolist()
lis_p_atm = p_atm.tolist() lis_T_wv = T_wv.tolist()
lis_p_up = p_up.tolist() lis_T_rv = T_rv.tolist()
# Drift # Druck
lis_m1_drift = m1_drift.tolist() lis_p_atm = p_atm.tolist()
lis_m2_drift = m2_drift.tolist() lis_p_up = p_up.tolist()
lis_m_sz = m_sz.tolist() # Drift
# Datum lis_m1_drift = m1_drift.tolist()
lis_date = datum.tolist() lis_m2_drift = m2_drift.tolist()
lis_dtime = time.tolist() lis_m1_sz = m_sz_1.tolist()
lis_m2_sz = m_sz_2.tolist()
lis_l1 = l_1.tolist() # Datum
lis_l2 = l_2.tolist() lis_date = datum.tolist()
lis_t1 = t_1.tolist() lis_dtime = time.tolist()
lis_t2 = t_2.tolist()
lis_l1 = l_1.tolist()
print(lis_l1 ,lis_l2 ,lis_t1 ,lis_t2 ) lis_l2 = l_2.tolist()
lis_t1 = t_1.tolist()
datum_meas = lis_date[0:1] lis_t2 = t_2.tolist()
print(lis_l1 ,lis_l2 ,lis_t1 ,lis_t2 )
print(lis_T_room)
datum_meas = lis_date[0:1]
print(lis_T_room)
doc["Calibration"]["Measurement"]["Values"]={"Temperature": [{"Unit": "C","Type": "T-H2O ","Comment":"Temperatur T ","Value": lis_T_h2o},
{"Unit": "C","Type": "T-Room","Comment":"Temperatur T","Value": lis_T_room},
{"Unit": "C","Type": "T-TL ","Comment":"Temperatur T","Value": lis_T_tl},
{"Unit": "C","Type": "T-WV ","Comment":"Temperatur T","Value": lis_T_wv},
{"Unit": "C","Type": "T-RV ","Comment":"Temperatur T","Value": lis_T_rv}], doc["Calibration"]["Measurement"]["Values"]={"Temperature": [{"Unit": "C","Type": "T-H2O","Comment":"Temperatur T ","Value": lis_T_h2o},
"Pressure": [{"Unit": "mbar","Type": "Atmosparic pressure ","Value": lis_p_atm}, {"Unit": "C","Type": "T-Room","Comment":"Temperatur T","Value": lis_T_room},
{"Unit": "bar","Type": "Upstream pressure ","Value": lis_p_up}], {"Unit": "C","Type": "T-TL","Comment":"Temperatur T","Value": lis_T_tl},
"Time": [{"Unit": "s","Type": "Zeit des ersten Sägezahns ","Value": lis_t1}, {"Unit": "C","Type": "T-WV","Comment":"Temperatur T","Value": lis_T_wv},
{"Unit": "s","Type": "Zeit des zweiten Sägezahns ","Value": lis_t2}], {"Unit": "C","Type": "T-RV","Comment":"Temperatur T","Value": lis_T_rv}],
"L": [{"Unit": "mm","Type": "Hub des ersten Sägezahns ","Value": lis_l1}, "Pressure": [{"Unit": "Pa","Type": "Atmosparic pressure","Value": lis_p_atm},
{"Unit": "mm","Type": "Hub des zweiten Sägezahns ","Value": lis_l2}], {"Unit": "bar","Type": "Upstream pressure","Value": lis_p_up}],
"Drift": [{"Unit": "mbar/s","Type": "Steigung des Sägezahns ","Value": lis_m_sz}, "Time": [{"Unit": "s","Type": "Zeit des ersten Saegezahns","Value": lis_t1},
{"Unit": "mbar/s","Type": "Drift des ersten Sägezahns ","Value": lis_m1_drift}, {"Unit": "s","Type": "Zeit des zweiten Saegezahns","Value": lis_t2}],
{"Unit": "mbar/s","Type": "Drift des zweiten Sägezahns ","Value": lis_m2_drift}], "L": [{"Unit": "mm","Type": "Hub des ersten Saegezahns","Value": lis_l1},
"DateTime": [{"Unit": "yyyy-mm-dd","Type": "Date ","Value": lis_date}, {"Unit": "mm","Type": "Hub des zweiten Saegezahns","Value": lis_l2}],
{"Unit": "hh:mm","Type": "Time ","Value": lis_dtime}]} "Drift": [{"Unit": "Pa/s","Type": "Steigung des ersten Saegezahns","Value": lis_m1_sz},
{"Unit": "Pa/s","Type": "Steigung des zweiten Saegezahns","Value": lis_m2_sz},
{"Unit": "Pa/s","Type": "Drift des ersten Saegezahns","Value": lis_m1_drift},
{"Unit": "Pa/s","Type": "Drift des zweiten Saegezahns","Value": lis_m2_drift}],
doc["Calibration"]["Measurement"]["Date"]=[{"Type": "measurement","Value":datum_meas}] "DateTime": [{"Unit": "yyyy-mm-dd","Type": "Date","Value": lis_date},
{"Unit": "hh:mm","Type": "Time ","Value": lis_dtime}]}
db.save(doc)
doc["Calibration"]["Measurement"]["Date"]=[{"Type": "measurement","Value":datum_meas}]
db.save(doc)
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment