Skip to content
Snippets Groups Projects
Commit f81ef88c authored by Chenxi Fu's avatar Chenxi Fu
Browse files

整理电路文件命名

parent 9ea1d312
No related branches found
No related tags found
1 merge request!38ngspice功能整理&画图配置更新
......@@ -34,6 +34,7 @@ parser_draw.add_argument('label', help='LABEL to identify root files')
parser_elec = subparsers.add_parser('elec', help='electronic readout')
parser_elec.add_argument('label', help='LABEL to identify electronics operations')
parser_elec.add_argument('name', help='LABEL to identify electronics files')
parser_elec.add_argument('-tct', help='signal from TCT', action="store_true")
parser_field = subparsers.add_parser('field', help='calculate field/weight field and iv/cv')
parser_field.add_argument('label', help='LABEL to identify operation')
......
......@@ -5,6 +5,7 @@ from util.output import output
def main(kwargs):
label = kwargs['label'] # Operation label or detector name
name = kwargs['name']
is_tct = kwargs['tct']
os.makedirs('output/elec/{}'.format(name), exist_ok=True)
if label == 'trans':
......@@ -18,10 +19,10 @@ def main(kwargs):
readout.main(label)
else:
from . import ngspice_set_input
from . import ngspice
input_p = ngspice_set_input.set_input(label)
from . import ngspice_set_tmp_cir
input_p = ngspice_set_input.set_input(label, is_tct)
input_c=','.join(input_p)
ngspice.ngspice(input_c, label, name)
ngspice_set_tmp_cir.ngspice_set_tmp_cir(input_c, label, name)
subprocess.run(['ngspice -b output/elec/{}/{}_tmp.cir'.format(label, name)], shell=True)
file_path = output(__file__, label)
from . import ngspice_get_fig
......
......@@ -7,13 +7,16 @@ ROOT.gROOT.SetBatch(True)
from util.output import output
# TODO: Need to be TOTALLY rewritten
def set_input(det_name, key=None):
def set_input(det_name, is_tct=False, key=None):
current=[]
time=[]
if key == None:
key = ""
path = "output/current/{}".format(det_name)
myFile = ROOT.TFile(os.path.join(path, "sim-current"+str(key))+".root")
if is_tct:
myFile = ROOT.TFile(os.path.join(path, "sim-current-TCT"+str(key))+".root")
else:
myFile = ROOT.TFile(os.path.join(path, "sim-current"+str(key))+".root")
myt = myFile.tree
for entry in myt:
......
import re
def ngspice(input_c, det_name, ele_name):
def ngspice_set_tmp_cir(input_c, det_name, ele_name):
with open('./param_file/circuit/{}.cir'.format(ele_name), 'r') as f:
lines = f.readlines()
for i in range(len(lines)):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment