Skip to content

Commit

Permalink
Merge branch 'nikitinvv-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
decarlof committed Feb 19, 2021
2 parents dd25065 + bf936a9 commit 7d2f1de
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 20 deletions.
3 changes: 3 additions & 0 deletions docs/source/tomoStreamApp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ tomoStream PVA Names
* - $(P)$(R)FlatPVAName
- stringout
- Contains the name of the TomoScan PVA where the flat images are stored
* - $(P)$(R)ThetaPVAName
- stringout
- Contains the name of the TomoScan PVA where the rotation angle positions are stored
* - $(P)$(R)ReconPVAName
- stringout
- Contains the name of the TomoStream PVA where the the selected 3 orthogonal slices are stored
Expand Down
4 changes: 2 additions & 2 deletions iocBoot/iocTomoStream/tomoStream.substitutions
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
file "$(TOP)/db/tomoStream.template"
{
pattern
{ P, R, TOMO_SCAN, IMAGE_P, DARK_PVA, FLAT_PVA, RECON_PVA}
{2bmb:, TomoStream:, 2bmb:TomoScan:, 2bmb:TomoScan:PvaPluginPVPrefix, 2bmb:TomoScan:StreamDarkFields, 2bmb:TomoScan:StreamFlatFields, 2bmb:TomoStream:StreamRecon}
{ P, R, TOMO_SCAN, IMAGE_P, DARK_PVA, FLAT_PVA, RECON_PVA, THETA_PVA}
{2bmb:, TomoStream:, 2bmb:TomoScanStream:, 2bmb:TomoScanStream:PvaPluginPVPrefix, 2bmb:TomoScanStream:StreamDarkFields, 2bmb:TomoScanStream:StreamFlatFields, 2bmb:TomoStream:StreamRecon, 2bmb:TomoStream:StreamTheta}
}
5 changes: 5 additions & 0 deletions tomoStreamApp/Db/tomoStream.template
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ record(stringout, "$(P)$(R)FlatPVAName")
field(VAL, "$(FLAT_PVA)")
}

record(stringout, "$(P)$(R)ThetaPVAName")
{
field(VAL, "$(THETA_PVA)")
}

record(stringout, "$(P)$(R)ReconPVAName")
{
field(VAL, "$(RECON_PVA)")
Expand Down
3 changes: 2 additions & 1 deletion tomoStreamApp/Db/tomoStream_settings.req
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ $(P)$(R)TomoScanPVPrefix
######################
# tomoStream PVA names
######################
$(P)$(R)ImagePVAPName
$(P)$(R)DarkPVAName
$(P)$(R)FlatPVAName
$(P)$(R)ThetaPVAName
$(P)$(R)ReconPVAName
$(P)$(R)ImagePVAPName

############################
# Streaming analysis control
Expand Down
43 changes: 36 additions & 7 deletions tomoStreamApp/op/adl/tomoStreamEPICS_PVs.adl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ file {
}
display {
object {
x=1854
y=159
width=455
height=190
x=6064
y=37
width=456
height=205
}
clr=14
bclr=4
Expand Down Expand Up @@ -115,7 +115,7 @@ rectangle {
x=5
y=40
width=445
height=140
height=160
}
"basic attribute" {
clr=14
Expand Down Expand Up @@ -241,7 +241,7 @@ text {
"text entry" {
object {
x=220
y=150
y=173
width=225
height=20
}
Expand All @@ -257,7 +257,7 @@ text {
text {
object {
x=100
y=150
y=173
width=110
height=20
}
Expand All @@ -267,3 +267,32 @@ text {
textix="Recon PVA"
align="horiz. right"
}
text {
object {
x=101
y=150
width=110
height=20
}
"basic attribute" {
clr=14
}
textix="Theta PVA"
align="horiz. right"
}
"text entry" {
object {
x=221
y=150
width=225
height=20
}
control {
chan="$(P)$(R)ThetaPVAName"
clr=14
bclr=51
}
format="string"
limits {
}
}
28 changes: 18 additions & 10 deletions tomostream/tomostream.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,20 @@ def __init__(self, pv_files, macros):

self.epics_pvs['RotationStep'] = PV(prefix + 'RotationStep')

self.epics_pvs['PSOPVPrefix'] = PV(prefix + 'PSOPVPrefix')
if self.epics_pvs['PSOPVPrefix'].get(as_string=True) == None:
log.error("TomoScan is down")
log.error("Type exit() here and start TomoScan first")
return
self.epics_pvs['ThetaArray'] = PV(self.epics_pvs['PSOPVPrefix'].get(as_string=True) + 'motorPos.AVAL')
# Replace PSOPVPrefix to link to check a TomoScanStream PV so it returns if scan IOC is down
# self.epics_pvs['PSOPVPrefix'] = PV(prefix + 'PSOPVPrefix')
# if self.epics_pvs['PSOPVPrefix'].get(as_string=True) == None:
# log.error("TomoScan is down")
# log.error("Type exit() here and start TomoScan first")
# return

# pva type channel for flat and dark fields pv broadcasted from the detector machine
self.epics_pvs['PvaDark'] = pva.Channel(self.epics_pvs['DarkPVAName'].get())
self.pva_dark = self.epics_pvs['PvaDark']
self.epics_pvs['PvaFlat'] = pva.Channel(self.epics_pvs['FlatPVAName'].get())
self.pva_flat = self.epics_pvs['PvaFlat']
self.epics_pvs['PvaTheta'] = pva.Channel(self.epics_pvs['ThetaPVAName'].get())
self.pva_theta = self.epics_pvs['PvaTheta']

# pva type channel that contains projection and metadata
image_pv_name = PV(self.epics_pvs['ImagePVAPName'].get()).get()
Expand Down Expand Up @@ -142,7 +144,10 @@ def reinit_monitors(self):
height = pva_image_data['dimension'][1]['size']
self.pv_rec['dimension'] = [{'size': 3*width, 'fullSize': 3*width, 'binning': 1},
{'size': width, 'fullSize': width, 'binning': 1}]
self.theta = self.epics_pvs['ThetaArray'].get()[:self.epics_pvs['NumAngles'].get()]
# self.theta = self.epics_pvs['ThetaArray'].get()[:self.epics_pvs['NumAngles'].get()]
self.theta = self.pva_theta.get()['value']
print(self.theta)
#exit()
# update limits on sliders
# epics_pvs['OrthoXlimit'].put(width-1)
# epics_pvs['OrthoYlimit'].put(width-1)
Expand Down Expand Up @@ -224,7 +229,9 @@ def add_dark(self, pv):
if(self.stream_is_running and len(pv['value'])==self.width*self.height): # if pv with dark field has cocrrect sizes
data = pv['value'].reshape(self.height, self.width)
self.slv.set_dark(data)
log.warning('new dark fields acquired')
print('Norm dark', np.linalg.norm(data))
log.error('new dark fields acquired')


def add_flat(self, pv):
"""PV monitoring function for reading new flat fields from manually running pv server
Expand All @@ -233,7 +240,8 @@ def add_flat(self, pv):
if(self.stream_is_running and len(pv['value'])==self.width*self.height): # if pv with flat has correct sizes
data = pv['value'].reshape(self.height, self.width)
self.slv.set_flat(data)
log.warning('new flat fields acquired')
print('Norm flat', np.linalg.norm(data))
log.error('new flat fields acquired')

def begin_stream(self):
"""Run streaming reconstruction by sending new incoming projections from the queue to the solver class,
Expand Down

0 comments on commit 7d2f1de

Please sign in to comment.