@@ -20,7 +20,7 @@ class UserDataProcessor:
2020
2121 def __init__ (self , configDict = {}):
2222 ...
23- # The following will be set after object gets created .
23+ # The following will be set after processor gets instantiated .
2424 self .processorId = None
2525 self .pvaServer = None
2626 self .outputChannel = None
@@ -651,9 +651,10 @@ channel names/PvObject queues.
651651</p >
652652
653653This example uses [ sample AD metadata processor] ( ../examples/hpcAdMetadataProcessorExample.py ) module which is capable of
654- associating images with available metadata based on their timestamp comparison.
655-
656- Donwload the sample metadata processor and start data collector on terminal 1 using the following command:
654+ associating images with available metadata based on their timestamp comparison, and producing NtNdArray objects
655+ that contain additional metadata attributes. To see how it works,
656+ download the sample metadata processor and start data collector on terminal 1
657+ using the following command:
657658
658659``` sh
659660$ pvapy-hpc-collector \
@@ -672,22 +673,23 @@ $ pvapy-hpc-collector \
672673 --metadata-channels pva://x,pva://y,pva://z
673674```
674675
675- On terminal 2 generate test images on channel pvapy: image and PVA metadata on channels x, y , and z :
676+ On terminal 2 generate test images on channel ' pvapy: image ' and PVA metadata on channels 'x', 'y' , and 'z' :
676677
677678``` sh
678- $ pvapy-ad-sim-server -cn pvapy:image -nx 128 -ny 128 -fps 100 -rp 100 -rt 60 \
679+ $ pvapy-ad-sim-server \
680+ -cn pvapy:image -nx 128 -ny 128 -fps 100 -rp 100 -rt 60 \
679681 -mpv pva://x,pva://y,pva://z
680682```
681683
682- Once image generation starts, on terminal 3 inspect both the original and processed images. The output channel
684+ After image generation starts, on terminal 3 inspect both the original and processed images. The output channel
683685should contain the original image data plus values for x, y, and z attributes:
684686
685687``` sh
686688$ pvget pvapy:image # original image, no metadata
687689$ pvget collector:1:output # should contain x,y,z metadata
688690```
689691
690- Note that the generated PVA metadata channels will have a structure containing value and timestamp:
692+ Note that the generated PVA metadata channels have a structure containing value and timestamp:
691693
692694``` sh
693695$ pvinfo x
@@ -702,18 +704,72 @@ Type:
702704 int userTag
703705```
704706
705- Since retrieving PVs from CA IOCs results in the same channel structure as above,
707+ Since retrieving PVs from CA IOCs results in the same channel structure as in the above example ,
706708the sample metadata processor works with either CA or PVA metadata channels. This can be verified
707- by requesting the AD simulation server to generate CA metadata :
709+ by replacing the AD simulation server command with the following :
708710
709711``` sh
710712$ EPICS_DB_INCLUDE_PATH=/path/to/epics-base/dbd pvapy-ad-sim-server \
711- -cn pvapy:image -nx 128 -ny 128 -fps 1 -rt 60 -mpv x,y,z
713+ -cn pvapy:image -nx 128 -ny 128 -fps 1 -rt 60 \
714+ -mpv x,y,z
715+ ```
716+
717+ This command will start CA IOC and generate CA metadata channels 'x', 'y', and 'z'.
718+ Note that it requires path to the EPICS Base dbd folder. For example, if you are using PvaPy
719+ conda package, this folder would be located at '/path/to/conda/envs/env-name/opt/epics/dbd'.
720+
721+ ### Metadata Handling with Distributed Consumers
722+
723+ Distributing metadata processing should allow one to handle higher frame rates. In this example
724+ we also use mirror server for all image and metadata channels.
725+
726+ <p align =" center " >
727+ <img alt =" Metadata Handling with Distributed Consumers " src =" images/StreamingFrameworkMetadataHandlingDataConsumers.jpg " >
728+ </p >
729+
730+ On terminal 1, start 4 metadata processors listening on 'pvapy: image ' channel:
731+
732+ ``` sh
733+ $ pvapy-hpc-consumer \
734+ --consumer-id 1 \
735+ --n-consumers 4 \
736+ --input-channel pvapy:image \
737+ --control-channel consumer:* :control \
738+ --status-channel consumer:* :status \
739+ --output-channel consumer:* :output \
740+ --processor-file /path/to/hpcAdMetadataProcessorExample.py \
741+ --processor-class HpcAdMetadataProcessor \
742+ --processor-args ' {"timestampTolerance" : 0.00025}' \
743+ --report-period 10 \
744+ --server-queue-size 2000 \
745+ --accumulate-objects 10 \
746+ --monitor-queue-size 0 \
747+ --distributor-updates 1 \
748+ --metadata-channels pva://pvapy:x,pva://pvapy:y,pva://pvapy:z
749+ ```
750+
751+ Each consumer will accumulate 10 images in the queue before processing them, in order to make sure
752+ all metadata arrives before it is needed.
753+
754+ On terminal 2, start mirror server mapping all channels:
755+
756+ ``` sh
757+ $ pvapy-mirror-server \
758+ --channel-map " (pvapy:image,ad:image,pva,1000),(pvapy:x,ad:x,pva,1000),(pvapy:y,ad:y,pva,1000),(pvapy:z,ad:z,pva,1000)"
759+ ```
760+
761+ On terminal 3 generate images and metadata:
762+
763+ ``` sh
764+ $ pvapy-ad-sim-server \
765+ -cn ad:image -nx 128 -ny 128 -fps 2000 -rp 2000 -rt 60 \
766+ -mpv pva://ad:x,pva://ad:y,pva://ad:z
712767```
713768
714- The above command will start CA IOC and generate CA metadata channels x, y, and z. It requires
715- path to EPICS Base dbd folder. For example, if you ar eusing PvaPy conda package, this folder would
716- be /path/to/conda/envs/env-name/opt/epics/dbd.
769+ Processing speed gains are not linear when compared to the single consumer case, because
770+ each consumer receives alternate set of images and all metadata values, and hence some
771+ metadata values will have to be discarded. This will be reflected in the metadata
772+ processor statistics.
717773
718774### Data Encryption
719775
0 commit comments