示例#1
0
def test_mask_neighbors_3d(allnbrs=True):
    from pyimgalgos.NDArrGenerators import random_exponential
    import pyimgalgos.Graphics as gr

    #randexp = random_exponential(shape=(2,2,30,80), a0=1)
    randexp = random_exponential(shape=(2, 30, 80), a0=1)

    fig = gr.figure(figsize=(16, 6), title='Random > 2-d mask')
    axim1 = gr.add_axes(fig, axwin=(0.05, 0.05, 0.40, 0.91))
    axcb1 = gr.add_axes(fig, axwin=(0.452, 0.05, 0.01, 0.91))

    axim2 = gr.add_axes(fig, axwin=(0.55, 0.05, 0.40, 0.91))
    axcb2 = gr.add_axes(fig, axwin=(0.952, 0.05, 0.01, 0.91))

    mask = np.select((randexp > 6, ), (0, ), default=1)
    mask_nbrs = mask_neighbors(mask, allnbrs)

    img1 = reshape_nda_to_2d(mask)
    img2 = reshape_nda_to_2d(mask_nbrs)

    imsh1, cbar1 = gr.imshow_cbar(fig,
                                  axim1,
                                  axcb1,
                                  img1,
                                  amin=0,
                                  amax=10,
                                  orientation='vertical')
    imsh2, cbar2 = gr.imshow_cbar(fig,
                                  axim2,
                                  axcb2,
                                  img2,
                                  amin=0,
                                  amax=10,
                                  orientation='vertical')
    gr.show(mode=None)
示例#2
0
def test_mask_edges_2d(mrows=1, mcols=1):
    from pyimgalgos.NDArrGenerators import random_exponential
    import pyimgalgos.Graphics as gr

    fig = gr.figure(figsize=(8, 6), title='Mask edges 2-d')
    axim1 = gr.add_axes(fig, axwin=(0.05, 0.05, 0.87, 0.91))
    axcb1 = gr.add_axes(fig, axwin=(0.922, 0.05, 0.01, 0.91))

    mask = np.ones((20, 30))
    mask_out = mask_edges(mask, mrows, mcols)

    img1 = mask_out
    imsh1, cbar1 = gr.imshow_cbar(fig,
                                  axim1,
                                  axcb1,
                                  img1,
                                  amin=0,
                                  amax=10,
                                  orientation='vertical')
    gr.show(mode=None)
    'g-',
    'k-',
    'm-',
    'y-',
    'c-',
)
ylab = (
    'X1',
    'X2',
    'Y1',
    'Y2',
    'MCP',
    'XX',
    'YY',
)
ax = [gr.add_axes(fig, axwin=(x0, y0 + i * dy, w, h)) for i in range(NAXES)]

#------------------------------
wf, wt = None, None

myrun = next(ds.runs())
for n, evt in enumerate(myrun.events()):
    if n < EVSKIP: continue
    if n > EVENTS: break
    #print 50*'_', '\n Event # %d' % n
    print '  Event # %d' % n
    gr.set_win_title(fig, titwin='Event: %d' % n)

    #print 'Acqiris.1:'
    result = det1.raw(evt)
    if result is None: continue
示例#4
0
         'rsigma  csigma    bkgd     rms     son  imrow   imcol     x[um]     y[um]     r[um]  phi[deg]'

fmt = '%7d  %3s  %3d %4d %4d  %4d  %8.1f  %8.1f  %6.1f  %6.1f %6.2f  %6.2f'+\
      '  %6.2f  %6.2f  %6.2f'+\
      ' %6d  %6d  %8.0f  %8.0f  %8.0f  %8.2f'

pstore = PeakStore(env, runnum, prefix='peaks', add_header=addhdr, pbits=1)
pstore.print_attrs()

##-----------------------------
fig, axim, axcb = gg.fig_axes() if DO_PLOT else (None, None, None)

fighi, axhi = None, None
if DO_SPEC :
    fighi = gr.figure(figsize=(6,5), title='Spectrum of pixel intensities', move=(800,0))
    axhi  = gr.add_axes(fighi, (0.17, 0.12, 0.78, 0.78))

##-----------------------------

def geo_pars(s,r,c) :
    inds = (s,r,c)
    return imRow[inds], imCol[inds], Xum[inds], Yum[inds], Rum[inds], Phi[inds]

##-----------------------------

t0_sec_evloop = time()
npeaks_tot = 0
nda = None
peaks = None

# loop over events in data set