Skip to content
Snippets Groups Projects
Commit 8ec41541 authored by Eduard Friske's avatar Eduard Friske
Browse files

Zusammenführung 20240506

parents e94a5588 3935a965
No related branches found
No related tags found
No related merge requests found
# leak analysis
Python-Programme für die Auswertung und Erstellung von Kalibrierscheinen ( TL1, TL2)
# writeLaTex-ks-TL1.py:
Erstellung eines Kalibrierscheins für TL1 , nur das Tex-Dokument
# writeLaTex-ks-TL2.py:
Erstellung eines Kalibrierscheins für TL2 , nur das Tex-Dokument
# attachment_cer.py:
Kalibrierscheine werden an das cer-dokument angehängt
# attachment_bur.py:
Manuelle veränderte Versandaufträge und Gefahrenstoffe werden an das bur-dokument angehängt
# API-V2-elab.py:
Messwerte werden in das Laborbuch übertragen
# file-to-couchdb_tl1_cL.py:
Die Werte aus dem Messprogramm TL1 werden in das cal-dokument übertragen
# file-to-couchdb_tl2.py:
Die Werte aus dem Messprogramm TL1 werden in das cal-dokument übertragen
Genaue Erklärung folgt:
# leak analysis
Python-Programme für die Auswertung und Erstellung von Kalibrierscheinen ( TL1, TL2)
# writeLaTex-ks-TL1.py:
Erstellung eines Kalibrierscheins für TL1 , nur das Tex-Dokument
# writeLaTex-ks-TL2.py:
Erstellung eines Kalibrierscheins für TL2 , nur das Tex-Dokument
# attachment_cer.py:
Kalibrierscheine werden an das cer-dokument angehängt
# attachment_bur.py:
Manuelle veränderte Versandaufträge und Gefahrenstoffe werden an das bur-dokument angehängt
# API-V2-elab.py:
Messwerte werden in das Laborbuch übertragen
# file-to-couchdb_tl1_cL.py:
Die Werte aus dem Messprogramm TL1 werden in das cal-dokument übertragen
# file-to-couchdb_tl2.py:
Die Werte aus dem Messprogramm TL1 werden in das cal-dokument übertragen
Genaue Erklärung folgt:
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 19 15:11:54 2024
@author: becker07
"""
import pathlib
import os
import couchdb
couch = couchdb.Server('http://a73434.berlin.ptb.de:5984')
db = couch['vl_db'] # existing
########## Vorgangsnummer und Jahr angeben #########
vn = "10"
year = "24"
bur = "bur-7.5-1V-" + year + "-" + vn
print(bur)
doc = db.get(bur)
sign = doc["Bureaucracy"]["Customer"]["Sign"]
sign = sign.lower()
########### Schedule Date finden ##############
n = 1000
i = 0
while i <= n:
date_type=doc["Bureaucracy"]["Date"][i]["Type"]
date=doc["Bureaucracy"]["Date"][i]["Value"]
if date_type == 'schedule':
i=n
i = i + 1
print (date_type,date )
i = 0
##################################################################
vn_np=float(vn)
if vn_np < 100:
if vn_np < 10:
vn_str = '00'+ vn
else:
vn_str = '0'+ vn
else:
vn_str = vn
print(vn_str)
vs= 'shipping-' + sign + '-' + vn_str + '-' + date
dang= 'dangerousgoods-' + sign + '-' + vn_str + '-' + date
print(vs,dang)
#dangerousgoods-alc-010-2024-01-22
vs_pdf= vs + ".pdf"
vs_tex= vs + ".tex"
#print(cer_pdf, cer_tex)
ship_pdf = "C:\\Users\\becker07\\ptb-latex\\versandauftrag\\" + vs_pdf
ship_tex = "C:\\Users\\becker07\\ptb-latex\\versandauftrag\\" + vs_tex
dg_pdf= dang + ".pdf"
dg_tex= dang + ".tex"
#print(cer_pdf, cer_tex)
dang_pdf = "C:\\Users\\becker07\\ptb-latex\\gefahrgutformular\\" + dg_pdf
dang_tex = "C:\\Users\\becker07\\ptb-latex\\gefahrgutformular\\" + dg_tex
################### Versand, Gefahrenstoffe werden an das bur-json-dokument angehangen ##################
content_ship_pdf=pathlib.Path(ship_pdf).read_bytes()
content_ship_tex=pathlib.Path(ship_tex).read_bytes()
db.put_attachment(doc, content_ship_pdf, vs_pdf , content_type='application/pdf')
db.put_attachment(doc, content_ship_tex, vs_tex , content_type='text/plain')
content_dang_pdf=pathlib.Path(dang_pdf).read_bytes()
content_dang_tex=pathlib.Path(dang_tex).read_bytes()
db.put_attachment(doc, content_dang_pdf, dg_pdf , content_type='application/pdf')
db.put_attachment(doc, content_dang_tex, dg_tex , content_type='text/plain')
################### die Kalibrierscheine werden im Ordner Kalibrierscheine gelöscht ##################
#cer_pdf= "ks-" +cers[i] + "-" + year + ".pdf"
#cer_tex= "ks-" +cers[i] + "-" + year + ".tex"
#cer_aux= "ks-" +cers[i] + "-" + year + ".aux"
#cer_log= "ks-" +cers[i] + "-" + year + ".log"
#cer_gz= "ks-" +cers[i] + "-" + year + ".synctex.gz"
#print(cer_pdf, cer_tex)
#ks_pdf = "C:\\Users\\becker07\\kalibrierschein\\" + cer_pdf
#ks_tex = "C:\\Users\\becker07\\kalibrierschein\\" + cer_tex
#ks_aux = "C:\\Users\\becker07\\kalibrierschein\\" + cer_aux
#ks_log = "C:\\Users\\becker07\\kalibrierschein\\" + cer_log
#ks_gz = "C:\\Users\\becker07\\kalibrierschein\\" + cer_gz
#print(ks_pdf, ks_tex)
#os.remove(ks_pdf)
#os.remove(ks_tex)
#os.remove(ks_aux)
#os.remove(ks_log)
#os.remove(ks_gz)
......@@ -7,27 +7,57 @@ Created on Fri Jan 6 11:14:44 2023
import pathlib
import os
import couchdb
try:
from configparser import ConfigParser
except ImportError:
from ConfigParser import ConfigParser # ver. < 3.0
configtl1 = ConfigParser()
ini_values = ConfigParser()
# parse existing file
configtl1.read('tl1.ini')
ini_values.read('inputs.ini')
# read values from a section
cal_cert = ini_values.get('input_cer', 'cal_cert')
year = ini_values.get('input_gen', 'year')
year_str2=year[2:]
no = ini_values.get('input_gen', 'no')
path=configtl1.get('path', 'path')
server=configtl1.get('couch', 'couch')
db_vl=configtl1.get('couch', 'db')
couch = couchdb.Server(server)
db = couch[db_vl] # existing
RefNo = ini_values.get('bur', 'RefNo')
RefNo='bur-7.5-1V-' + year_str2 + '-' + RefNo
couch = couchdb.Server('http://a73434.berlin.ptb.de:5984')
db = couch['vl_db'] # existing
print(RefNo)
doc_RefNo = db.get(RefNo)
year = "2024"
cers =doc_RefNo["Bureaucracy"]["Certificate"]
cers = ["75552","75553"] # Beispiel: cers = ["75511_0001","75512_0001"]
#cers = ["75552","75553"] # Beispiel: cers = ["75511_0001","75512_0001"]
#cers = ["75562","75563"] # Beispiel: cers = ["75511_0001","75512_0001"]
################### die Kalibrierscheine werden an das cer-json-dokument angehangen ##################
i = 0
while i < len(cers):
json_file = "cer-" + year + '-' + cers[i]
for cers_i in cers:
print(cers_i)
cers_i=str(cers_i)
json_file = "cer-" + year + '-' + cers_i
print(json_file)
doc = db.get(json_file)
cer_pdf= "ks-" +cers[i] + "-" + year + ".pdf"
cer_tex= "ks-" +cers[i] + "-" + year + ".tex"
cer_pdf= "ks-" +cers_i + "-" + year + ".pdf"
cer_tex= "ks-" +cers_i + "-" + year + ".tex"
print(cer_pdf, cer_tex)
ks_pdf = "C:\\Users\\becker07\\kalibrierschein\\" + cer_pdf
ks_tex = "C:\\Users\\becker07\\kalibrierschein\\" + cer_tex
......@@ -37,21 +67,21 @@ while i < len(cers):
db.put_attachment(doc, content_pdf, cer_pdf , content_type='application/pdf')
db.put_attachment(doc, content_tex, cer_tex , content_type='text/plain')
i += 1
################### die Kalibrierscheine werden im Ordner Kalibrierscheine gelöscht ##################
i = 0
while i < len(cers):
json_file = "cer-" + year + '-' + cers[i]
for cers_i in cers:
cers_i=str(cers_i)
json_file = "cer-" + year + '-' + cers_i
print(json_file)
doc = db.get(json_file)
cer_pdf= "ks-" +cers[i] + "-" + year + ".pdf"
cer_tex= "ks-" +cers[i] + "-" + year + ".tex"
cer_aux= "ks-" +cers[i] + "-" + year + ".aux"
cer_log= "ks-" +cers[i] + "-" + year + ".log"
cer_gz= "ks-" +cers[i] + "-" + year + ".synctex.gz"
cer_pdf= "ks-" + cers_i + "-" + year + ".pdf"
cer_tex= "ks-" + cers_i + "-" + year + ".tex"
cer_aux= "ks-" + cers_i + "-" + year + ".aux"
cer_log= "ks-" + cers_i + "-" + year + ".log"
cer_gz= "ks-" + cers_i + "-" + year + ".synctex.gz"
print(cer_pdf, cer_tex)
ks_pdf = "C:\\Users\\becker07\\kalibrierschein\\" + cer_pdf
ks_tex = "C:\\Users\\becker07\\kalibrierschein\\" + cer_tex
......@@ -66,4 +96,4 @@ while i < len(cers):
os.remove(ks_log)
os.remove(ks_gz)
i += 1
\ No newline at end of file
\ No newline at end of file
{
"Pfad":
{
"Messwerte": "/home/friske01/O/Vakuum/Messplaetze/TL2/Messwerte/",
"Kalibrierschein": "/home/friske01/KS/"
},
"KS-Daten":
{
"Jahr": 2024,
"lfd. Nr.": 1
}
}
......@@ -28,7 +28,9 @@ db = couch['vl_db'] # existing
cal_cert = "75559"
year = "2024"
no = "0001"
......
This diff is collapsed.
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 22 11:21:17 2024
@author: becker07
"""
from matplotlib import pyplot as plt
import pathlib
from statistics import mean
from datetime import datetime
from IPython.display import Markdown as md
import numpy as np
import re
import math
import statistics
import pandas as pd
import json
import couchdb
import PyPDF2
couch = couchdb.Server('http://a73434.berlin.ptb.de:5984')
db = couch['vl_db'] # existing
#json_file = "cal-" + year + "-fm1-" + "-" + cal_cert + "_" + no
json_file = "cal-2024-fm1-kk-75565_0001"
print(json_file)
doc = db.get(json_file)
I_Scan_Offs=np.array(doc["Calibration"]["Measurement"]["AuxValues"]["ScanQMS"][2]["Value"])
I_Scan_Offs=np.float64(I_Scan_Offs[2:-2])
I_Scan=np.array(doc["Calibration"]["Measurement"]["AuxValues"]["ScanQMS"][1]["Value"])
I_Scan=np.float64(I_Scan[2:-2])
Mass_Scan=np.array(doc["Calibration"]["Measurement"]["AuxValues"]["ScanQMS"][0]["Value"])
Mass_Scan=Mass_Scan[2:-2]
for i in range(len(Mass_Scan)):
Mass_Scan[i] = re.sub(r"Mass ", "", Mass_Scan[i]).strip()
Mass_Scan=np.float64(Mass_Scan)
fig=plt.figure()
ax=fig.add_axes([0,0,4,2])
ax.set_xlabel('Masse')
ax.set_ylabel('QMS-Signal')
ax.set_yscale('log')
#plt.plot(1010,4.65e-10, 'bo')
plt.plot(Mass_Scan,I_Scan, label=r'Flow')
plt.plot(Mass_Scan,I_Scan_Offs,label=r'Offset' )
plt.legend()
plt.grid()
fig.savefig("Scan.pdf", bbox_inches='tight')
content=pathlib.Path('Scan.pdf').read_bytes()
db.put_attachment(doc, content, "Scan.pdf" , content_type="'application/pdf")
tl.ini 0 → 100644
[path]
path_ks=C:\\Users\\becker07\\kalibrierschein\\ks-
path_files=C:\\Users\\becker07\\python\\TL1\\
[couch]
couch = http://a73434.berlin.ptb.de:5984
db = vl_db
[api]
API_HOST_URL = https://elabftw.ptb.de/api/v2
API_KEY = Beispiel
\ No newline at end of file
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