Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
added camera generation parameter in pymepix command line paramteres
Browse files Browse the repository at this point in the history
  • Loading branch information
samartse committed Jul 3, 2023
1 parent 6ab0c51 commit f134c0f
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions pymepix/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
def connect_timepix(args):
if not os.path.exists(args.output):
# Connect to camera
pymepix = PymepixConnection(cam_address=(args.ip, args.port))
pymepix = PymepixConnection(cam_address=(args.ip, args.port),
camera_generation=args.cam_gen)
# If there are no valid timepix detected then quit()
if len(pymepix) == 0:
logging.error(
Expand Down Expand Up @@ -83,14 +84,14 @@ def connect_timepix(args):
f"Outputfile {args.output} already exists. Please make sure the specified file does not exist."
)


def post_process(args):
run_post_processing(
args.file.name,
args.output_file,
args.number_of_processes,
args.timewalk_file,
args.cent_timewalk_file,
args.cam_gen,
)

pymepix_connection_obj = None
Expand Down Expand Up @@ -204,7 +205,8 @@ def make_app():

def start_api(args):
global pymepix_connection_obj
pymepix_connection_obj = PymepixConnection(cam_address=(args.ip, args.port))
pymepix_connection_obj = PymepixConnection(cam_address=(args.ip, args.port),\
camera_generation=args.cam_gen)

if len(pymepix_connection_obj) == 0:
logging.error(
Expand Down Expand Up @@ -310,6 +312,15 @@ def main():
help="Config file",
)

parser_connect.add_argument(
"-g",
"--cam_gen",
dest="cam_gen",
type=int,
default=3,
help="Camera generation",
)

parser_post_process = subparsers.add_parser(
"post-process", help="Perform post-processing with a acquired raw data file."
)
Expand Down Expand Up @@ -361,6 +372,16 @@ def main():
help="Config file",
)

parser_post_process.add_argument(
"-g",
"--cam_gen",
dest="cam_gen",
type=int,
default=3,
help="Camera generation",
)


parser_api_service = subparsers.add_parser(
"api-service", help="start api service."
)
Expand Down Expand Up @@ -432,6 +453,15 @@ def main():
help="Bias voltage in Volts",
)

parser_api_service.add_argument(
"-g",
"--cam_gen",
dest="cam_gen",
type=int,
default=3,
help="Camera generation",
)


args = parser.parse_args()
print(args)
Expand Down

0 comments on commit f134c0f

Please sign in to comment.