tjlane / pypad

Intuitive, high-level interface to the CSPAD
Other
2 stars 1 forks source link

written mask from `genmask` in `cheetah` format does not seem to include automatically masked pixels #46

Closed sellberg closed 10 years ago

sellberg commented 11 years ago

See last (Aug 1, 2013) comment in #21 , 14375 negative pixels were masked automatically but do not appear masked when running it in the cheetah...

pypad(master):575 11:42:55] genmask examples/gold-minus470mm.h5 -o test.h5 -f cheetah Loading: examples/gold-minus470mm.h5

--- WELCOME TO PYPAD's INTERACTIVE MASKING ENVIRONMENT ---

Green pixels are masked.

Keystrokes


m : mask u : unmask r : reset x : clear selection w : save & exit t : toggle pixel q : exit w/o saving

Mouse


Right click on three or more points to draw a polygon around a set of pixels. Then press m or u to mask or unmask that area.

You can also mask/unmask single pixels by clicking on them with the mouse and pressing t to toggle the mask state.

Toggle Buttons (left)


nonbonded : Mask nonbonded pixels, and their nearest neighbours. These pixels aren't even connected to the detector.

row 13 : In some old experiments, row 13 on one ASIC was busted -- mask that (will be clear if this is needed)

threshold : You will be prompted for an upper and lower limit -- pixels outside that range are masked. Units are ADUs and you can set only a lower/upper limit by passing 'None' for one option.

borders : Mask the borders of each ASIC. These often give anomoulous responses. Recommended to mask one pixel borders at least.

                      ----- // -----

Masked: 14375 negative pixels Selected: (226, 289) Masking convex area... Wrote: test.h5

tjlane commented 11 years ago

@sellberg I haven't been able to reproduce this error... here's what I'm doing:

genmask examples/gold-minus490mm.h5 -f cheetah

Then masking as follows,

mask

then press "w" to get a file my_mask.mask.h5. Then running the following code

import h5py
from pylab import *

f = h5py.File('my_mask.mask.h5')
d = array(f['/data/data'])
f.close()

imshow(d, interpolation='nearest')
show()

to visualize the mask yields

mask2

It appears that the negative and manually masked regions are good. What does your output look like?

sellberg commented 11 years ago

@tjlane here is how my test.h5 mask looks like

screen shot 2013-08-01 at 20 24 25

I get the same result as you, but I think I know what it is... Have you the automasking to be < 0 or <= 0? I'm suspecting it is the first one of the two, whereas 0 still turns out as green in the log plot (I'm guessing you're taking NaN and making them green) and hence implies it's masked. I think we should change so that automasking is done for pixels <= 0, since it's very convenient that an old mask already used on the intensities (i.e. sets the pixels to 0) is automasked when PyPad loads the intensities. Do you agree? Should be an supereasy fix.

tjlane commented 11 years ago

@sellberg good thinking, I agree! Here is the line of code:

https://github.com/tjlane/pypad/blob/master/pypad/mask.py#L462

it is < 0.0. I'll patch it to <=, and then confirm it's doing what you want!