Skip to content
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

Add experiment type #702

Merged
merged 6 commits into from
Apr 24, 2024
Merged

Add experiment type #702

merged 6 commits into from
Apr 24, 2024

Conversation

toastisme
Copy link
Contributor

@toastisme toastisme commented Mar 5, 2024

This adds Experiment.get_type(), which returns an ExperimentType enum. The idea is to replace Experiment.is_still()/Experiment.is_sequence() with something more flexible.

There is an argument that this goes a bit against the dials as a toolkit ethos, where you should be able to mix pipelines of algorithms. However, the workflow for stills and rotational experiments are distinct enough that a quick way of identifying them is useful (is_still()), and time of flight experiments are similar in being quite separate.

Experiments do not have a static enum applied to their type. Instead it's calculated on the fly to ensure it's always consistent and defined in only one place.

Copy link

codecov bot commented Mar 5, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 41.81%. Comparing base (ee74a3d) to head (e338670).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #702   +/-   ##
=======================================
  Coverage   41.81%   41.81%           
=======================================
  Files         187      187           
  Lines       16806    16810    +4     
  Branches     3210     3211    +1     
=======================================
+ Hits         7027     7029    +2     
- Misses       9133     9140    +7     
+ Partials      646      641    -5     

@toastisme
Copy link
Contributor Author

@phyy-nx @dwpaley do you guys have any opinions on this?

Copy link
Collaborator

@graeme-winter graeme-winter left a comment

Choose a reason for hiding this comment

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

If we can resolve the definition of sequences of stills, I am happy


def all_sequences(self):
"""Check if all the experiments are from sequences"""
return all(exp.is_sequence() for exp in self)
warnings.warn("all_sequences() is deprecated. Use all_rotations() instead")
Copy link
Collaborator

Choose a reason for hiding this comment

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

A still sequence is meaningful e.g. grid scan

@@ -74,6 +74,11 @@ namespace dxtbx { namespace model { namespace boost_python {
};

void export_experiment() {
enum_<ExperimentType>("ExperimentType")
.value("still", still)
Copy link
Collaborator

Choose a reason for hiding this comment

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

What about a sequence of stills?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I appreciate that the behaviour of the current system is not well defined?

@@ -28,6 +28,8 @@

namespace dxtbx { namespace model {

enum ExperimentType { rotation = 1, still = 2, tof = 3 };
Copy link
Collaborator

Choose a reason for hiding this comment

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

Enumerations are usually ENUMERATED?

@ndevenish
Copy link
Collaborator

ndevenish commented Apr 18, 2024

Discussion from core:

  • Make is_still/is_sequence should not be deprecated (here)
  • is_still/is_sequence should directly call get_type instead of calculating themselves
  • CAPITAL_ENUMS

…equence, and experiment_list.all_sequences. ExperimentType is now all caps. is_still and is_sequence call get_type to ensure they remain consistent.
@toastisme toastisme merged commit 6fcf993 into cctbx:main Apr 24, 2024
13 checks passed
@toastisme toastisme deleted the add_experiment_type branch April 24, 2024 14:06
toastisme added a commit to toastisme/dxtbx that referenced this pull request Jul 18, 2024
* Added ExperimentType to Experiment, accessed via get_type().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants