-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Format needs get_static_mask #70
Comments
The following is my attempt at rationalising the current state of masking in format classes/imagesets: Dynamic maskingI.e. a mask that varies image-to-image, with a dependence on the goniometer/scan. Overload the
(see Lines 500 to 504 in df55d9a
and set the This method is called by Lines 269 to 281 in df55d9a
Lines 427 to 447 in df55d9a
Lines 1244 to 1267 in 2086723
Line 1266 in 2086723
Lines 856 to 872 in 2086723
Goniometer shadow maskerGoniometer shadow maskers should be an instance of https://github.com/cctbx/dxtbx/blob/master/masking/goniometer_shadow_masking.h#L33-L225 There is a Lines 31 to 213 in 2086723
Static maskI.e. a mask that is common to all images in the imageset. The method Lines 838 to 854 in 2086723
Lines 816 to 836 in 2086723
Lines 802 to 814 in 2086723
The functionality that is currently missing is that there is no way for a format class to override/update the static mask. What is proposed in #65 (comment) and #70 is to add a
|
Where does "merging of a user-provided mask" happen? |
@biochem-fan this i
This happens in the call to Lines 838 to 846 in 2086723
The |
Does it mean
Then Shouldn't the first merging step with the user-provided mask ( |
Yes, that is what I understand of @jmp1985's suggestion.
This issue with this approach is that it would require further modification to |
@biochem-fan do you have a small example file (a single image would suffice) that we can use to exercise the format class-defined mask in |
There's one in dials_regression. test_stills_process.py uses it.
cd dials_regression/image_examples/SACLA_MPCCD_Cheetah
dxtbx.print_header run266702-0-subset.h5 | head
=== run266702-0-subset.h5 ===
Using header reader: FormatHDF5SaclaMPCCD
…On Fri, Aug 9, 2019 at 10:08 AM Richard Gildea ***@***.***> wrote:
@biochem-fan <https://github.com/biochem-fan> do you have a small example
file (a single image would suffice) that we can use to exercise the format
class-defined mask in dxtbx/format/FormatHDF5SaclaMPCCD.py? If this was
small enough we might be able to add it to
https://github.com/dials/data-files, or possibly better on zenodo as long
as the files aren't compressed (see e.g.
https://github.com/dials/data/blob/8b7f34c9467997fc49dedf2c563b946a2b770d33/dials_data/definitions/vmxi_thaumatin.yml
).
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#70?email_source=notifications&email_token=ADGY5SRDZ4DQ53WYRZCSLZDQDWP27A5CNFSM4II5XFR2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD37HS6A#issuecomment-519993720>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADGY5SRAXEX4VGADSHR6FITQDWP27ANCNFSM4II5XFRQ>
.
|
@rjgildea Isn't it simply modifying @phyy-nx That image was created by an early version of the pipeline and does not contain the mask. Please try https://drive.google.com/open?id=0ByqmCYlnqv6UU1RXb053MG1ucmc (11 MB). |
No, the merging step would be in the Format baseclass, probably somewhere around this point in https://github.com/dials/dxtbx/blob/master/format/Format.py#L427-L447 In the case of
Thanks! |
@rjgildea OK, this makes sense. |
Unfortunately it's not quite as simple as I'd hoped. Even if the imageset is returned here with the dxtbx/model/experiment_list.py Lines 227 to 230 in 2086723
the mask is then overwritten again here: dxtbx/model/experiment_list.py Lines 249 to 280 in 2086723
|
I've made a start towards this here 0e36727. This works if you run
However it doesn't work when loading from an experiments json file, due to the
|
@biochem-fan @phyy-nx do you also have example images for testing the masking in FormatHDF5SaclaRayonix.py and FormatPYunspecified.py? |
@rjgildea Currently the Rayonix detector at SACLA does not need a detector specific mask. The |
For FormatPYunspecified, see
dials_regression/image_examples/LCLS_CXI/shot-s00-2011-12-02T21_07Z29.723_00569.pickle
and shot-s04-20111204004533388.pickle. This format class is having issues
in py3 which I have to sort out at some point, but the file format itself
(serialized pickle dictionaries) is considered legacy at this point. We
aren't making any more of these files at LCLS and haven't been for some
time. But they are good examples of get_mask.
…On Mon, Aug 12, 2019 at 9:44 AM biochem_fan ***@***.***> wrote:
@rjgildea <https://github.com/rjgildea> Currently the Rayonix detector at
SACLA does not need a detector specific mask. The get_mask() function is
not used now (self.mask is always None). But they might become relevant
in future (i.e. when the detector gets damaged over time).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#70?email_source=notifications&email_token=ADGY5SXTSWSU3QJ6HAQY3EDQEGHQNA5CNFSM4II5XFR2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4DD3CQ#issuecomment-520502666>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADGY5SSVC4KQIITNIQZPA33QEGHQNANCNFSM4II5XFRQ>
.
|
It would probably still be a good idea to have an example dataset available so we can ensure test coverage of this format class. |
@keitaroyam or @phyy-nx, do you have a test image from Rayonix we can make public? |
@phyy-nx are the FormatPYunspecifiedInMemory/FormatPYunspecifiedStillInMemory classes still needed/expected to work? As far as I can tell they don't work as it stands: 5cdffe4#diff-e59100cf97d8b4af3427ae450ca1476eR34-R46
|
Hi, it's used in xtc_process, where the get_imageset method is never
called. Instead, this code pattern is used:
from libtbx import easy_pickle
from dxtbx.format.FormatPYunspecifiedStill import
FormatPYunspecifiedStillInMemory
from dxtbx.imageset import ImageSet, ImageSetData, MemReader
d =
easy_pickle.load('/net/dials/raid1/aaron/dialsbuild/modules/dials_regression/image_examples/LCLS_CXI/shot-s04-20111204004533388.pickle')
img = FormatPYunspecifiedStillInMemory(d)
imgset = ImageSet(ImageSetData(MemReader([img]), None))
Again, it's legacy code but it does still work I believe. The image
dictionary in shot-s04-20111204004533388.pickle was assembled in memory
earlier in xtc_process, and the MemReader is used so the image doesn't need
to be written to disk. Same principle with the cspad cbf in memory code
that we use now.
…On Tue, Aug 13, 2019 at 8:16 AM Richard Gildea ***@***.***> wrote:
@phyy-nx <https://github.com/phyy-nx> are the
FormatPYunspecifiedInMemory/FormatPYunspecifiedStillInMemory classes still
needed/expected to work? As far as I can tell they don't work as it stands:
5cdffe4#diff-e59100cf97d8b4af3427ae450ca1476eR34-R46
<5cdffe4#diff-e59100cf97d8b4af3427ae450ca1476eR34-R46>
$ pytest --regression tests/format/test_FormatPYunspecified.py::test_FormatPYunspecifiedStillInMemory --runxfail
...
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― test_FormatPYunspecifiedStillInMemory ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
dials_regression = '/Users/rjgildea/software/cctbx/modules/dials_regression'
@pytest.mark.xfail
def test_FormatPYunspecifiedStillInMemory(dials_regression):
filename = os.path.join(
dials_regression,
"image_examples/LCLS_CXI/shot-s00-2011-12-02T21_07Z29.723_00569.pickle",
)
assert not FormatPYunspecifiedStillInMemory.understand(filename)
with open(filename, "rb") as f:
d = pickle.load(f)
assert FormatPYunspecifiedStillInMemory.understand(d)
> mem_imageset = FormatPYunspecifiedStillInMemory.get_imageset(d) # noqa F841
tests/format/test_FormatPYunspecified.py:46:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
format/Format.py:321: in get_imageset
format_instance = Class(filenames[0], **format_kwargs)
format/FormatPYunspecifiedStill.py:70: in __init__
FormatPYunspecifiedInMemory.__init__(self, data, **kwargs)
format/FormatPYunspecified.py:227: in __init__
FormatPYunspecified.__init__(self, data, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <dxtbx.format.FormatPYunspecifiedStill.FormatPYunspecifiedStillInMemory object at 0x117146890>, image_file = '/Users/rjgildea/software/cctbx/modules/dxtbx/DISTANCE', kwargs = {}
def __init__(self, image_file, **kwargs):
"""Initialise the image structure from the given file."""
if not self.understand(image_file):
> raise IncorrectFormatError(self, image_file)
E IncorrectFormatError: (<dxtbx.format.FormatPYunspecifiedStill.FormatPYunspecifiedStillInMemory object at 0x117146890>, '/Users/rjgildea/software/cctbx/modules/dxtbx/DISTANCE')
format/FormatPYunspecified.py:46: IncorrectFormatError
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#70?email_source=notifications&email_token=ADGY5SVY35WFIF5THJIGT6TQELF6FA5CNFSM4II5XFR2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4F72AA#issuecomment-520879360>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADGY5SUZ55LXHV42E7TZ5CLQELF6FANCNFSM4II5XFRQ>
.
|
- Add an optional Format.get_static_mask() method to allow format classes to define a static mask to be used on all images. - Add tests for static masks in FormatHDF5SaclaMPCCD and FormatPYunspecifiedStill. - Remove superfluous Format.get_mask() functions - these are no longer called and the functionality they used to provide are provided elsewhere. Resolves #70 (see also #65).
Following discussion in #65,
Format
needs aget_static_mask
method. This will:None
imageset.external_lookup.mask.data = ImageBool(mask_flex_array_or_tuple_of_flex_arrays)
)The text was updated successfully, but these errors were encountered: