Skip to content
Snippets Groups Projects
Commit 76a13d06 authored by Ute Becker's avatar Ute Becker :relaxed:
Browse files

Auswerteprogramme TL1 und TL2

parent db5b977f
No related branches found
No related tags found
No related merge requests found
# -*- 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)
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 6 11:14:44 2023
@author: becker07
"""
import pathlib
import os
import couchdb
couch = couchdb.Server('http://a73434.berlin.ptb.de:5984')
db = couch['vl_db'] # existing
year = "2024"
cers = ["75564","75565","75566","75567","75568","75569","75570","75571","75572","75573"] # 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]
print(json_file)
doc = db.get(json_file)
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
print(ks_pdf, ks_tex)
content_pdf=pathlib.Path(ks_pdf).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_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]
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"
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)
i += 1
\ No newline at end of file
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")
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