diff --git a/__main__.py b/__main__.py index 274e1eaeabcc0d13099a1d3c8518503e4f136875..f220c4f06e7f68f385114e1970bc40abf7ba71c7 100755 --- a/__main__.py +++ b/__main__.py @@ -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') diff --git a/elec/__init__.py b/elec/__init__.py index a40bf2d504a74d4867af0d3b47627d58dcf0ff9f..85f43c8e77604bae0bb4a8d3694b188881358513 100644 --- a/elec/__init__.py +++ b/elec/__init__.py @@ -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 diff --git a/elec/ngspice_set_input.py b/elec/ngspice_set_input.py index 2a1e82edb0b0075f023edd319f9d07406d757a93..493357c8399d0b0afb578670e98e5d4ccad8a48f 100644 --- a/elec/ngspice_set_input.py +++ b/elec/ngspice_set_input.py @@ -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: diff --git a/elec/ngspice.py b/elec/ngspice_set_tmp_cir.py similarity index 93% rename from elec/ngspice.py rename to elec/ngspice_set_tmp_cir.py index aa6e8a59ed3058e266e9fd3d657ae9708c54cdf3..4ca936e95ac5816a43e4ed52e2ce39bbc008fa70 100644 --- a/elec/ngspice.py +++ b/elec/ngspice_set_tmp_cir.py @@ -1,5 +1,5 @@ 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)):