Skip to content

Conversation

@SimonHeybrock
Copy link
Member

The main change is around the new way of handling Optional. Pixel masks are now handled using map, which will also support multiple masks.

Note that this is incompatible with the released Sciline, i.e., we will need to make a synchronized release.

@SimonHeybrock SimonHeybrock requested a review from jl-wynen June 11, 2024 10:07
pyproject.toml Outdated
"plopp",
"pythreejs",
"sciline>=23.9.1",
"sciline @ git+https://github.com/scipp/sciline@main",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I told Johannes, I am not happy with depending on an unreleased version. Especially on a moving target, i.e., a branch, not a concrete commit.
Can we make a Sciline release now / soon before merging this PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure that is the plan, this is temporary to pass CI.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

return {key: value for d in dicts for key, value in d.items()}


def set_pixel_mask_filenames(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def set_pixel_mask_filenames(
def with_pixel_mask_filenames(

because it does not modify the input.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nvaytet Should we change all the naming of similar functions in ESSsans?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fine by me

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

" TofMask: lambda x: (x < sc.scalar(0.0, unit=\"ns\"))\n",
" | (x > sc.scalar(86e6, unit=\"ns\")),\n",
" TwoThetaMask: None,\n",
" WavelengthMask: None,\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have default params so users don't have to specify everything? I thought that was the plan anyway?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but as far as I could tell ESSdiffraction is not implementing C.5 yet (see https://github.com/scipp/essreduce/blob/main/docs/user-guide/reduction-workflow-guidelines.md#c5-use-a-fixed-pattern-for-creating-manipulating-and-running-workflows), so this is unrelated to this PR?

"\n",
"pipeline = sciline.Pipeline(providers, params=params)"
"pipeline = sciline.Pipeline(providers, params=params)\n",
"pipeline = powder.set_pixel_mask_filenames(pipeline, [])"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not great that this always needs to be called even when there are no file names. Can this be done with a default parameter?

Copy link
Member Author

@SimonHeybrock SimonHeybrock Jun 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but it cannot, unfortunately (since the Optional this is replacing is a couple of nodes downstream of the filename).

Alternatives:

  • Add parameter to the workflow creation, such DreamWorkflow(pixel_masks=[]).
  • Set a default for DetectorMasks, which has the pitfall that later setting PixelMaskFilename silently has no effect (since setting the default for DetectorMasks trimmed the branch of providers leading to PixelMaskFilename. set_pixel_mask_filenames could re-add this branch, but the pitfall remains.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about setting PixelMaskFilename = [] by default?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean as a default param in DreamWorkflow? That can be done, but mapping again differently afterwards is not possible.

@SimonHeybrock
Copy link
Member Author

As agreed elsewhere, I will merge and release. Main comments were addressed, other things (such as masking UX) can be improved later, once we have a better idea.

@SimonHeybrock SimonHeybrock merged commit 1100741 into main Jun 17, 2024
@SimonHeybrock SimonHeybrock deleted the next-sciline branch June 17, 2024 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants