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

Commit

Permalink
added parameter in RESTFUL operation for pipeline pixel of centroid
Browse files Browse the repository at this point in the history
  • Loading branch information
samartse committed Sep 15, 2023
1 parent 8d631d2 commit fe4438d
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions pymepix/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
from pymepix.post_processing import run_post_processing
from pymepix.pymepix_connection import PymepixConnection

from pymepix.processing.acquisition import PixelPipeline, CentroidPipeline

from tornado.web import Application, RequestHandler, HTTPError
import json

Expand Down Expand Up @@ -94,7 +96,6 @@ def post_process(args):
args.cam_gen,
)

pymepix_connection_obj = None

def is_jsonable(x):
try:
Expand Down Expand Up @@ -139,6 +140,7 @@ def get(self):

def post(self):
global pymepix_connection_obj

try:
data = json.loads(self.request.body)
except:
Expand Down Expand Up @@ -205,8 +207,16 @@ def make_app():

def start_api(args):
global pymepix_connection_obj

if args.pixel_pipeline == 'centroid':
pipeline_class = CentroidPipeline
else:
pipeline_class = PixelPipeline

pymepix_connection_obj = PymepixConnection(cam_address=(args.ip, args.port),\
camera_generation=args.cam_gen)
camera_generation=args.cam_gen,
pipeline_class=pipeline_class)


if len(pymepix_connection_obj) == 0:
logging.error(
Expand Down Expand Up @@ -462,6 +472,15 @@ def main():
help="Camera generation",
)

parser_api_service.add_argument(
"-pl",
"--pipeline",
dest="pixel_pipeline",
type=str,
default='pixel',
help="Processing pipeline, options: centroid, pixel. Default - pixel",
)


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

0 comments on commit fe4438d

Please sign in to comment.