Skip to content

Conversation

@henrikjacobsenfys
Copy link
Member

Add experiment class and minimal functionality

@henrikjacobsenfys henrikjacobsenfys added [scope] enhancement Adds/improves features (major.MINOR.patch) [priority] medium Normal/default priority labels Jan 27, 2026
@codecov
Copy link

codecov bot commented Jan 27, 2026

Codecov Report

❌ Patch coverage is 97.29730% with 4 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@fef02f4). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/easydynamics/experiment/experiment.py 97.26% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop      #90   +/-   ##
==========================================
  Coverage           ?   97.63%           
==========================================
  Files              ?       30           
  Lines              ?     1606           
  Branches           ?      268           
==========================================
  Hits               ?     1568           
  Misses             ?       21           
  Partials           ?       17           
Flag Coverage Δ
integration 0.00% <0.00%> (?)
unittests 97.63% <97.29%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@henrikjacobsenfys henrikjacobsenfys marked this pull request as ready for review January 27, 2026 18:53
Copy link
Member

@AndrewSazonov AndrewSazonov left a comment

Choose a reason for hiding this comment

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

Small suggestion: it would be nice to update the placeholder markdown header cells to use the notebook title and short description I added in the previous PR (and also add one to the new experiment.ipynb). That way the code cells can automatically stretch to the full page width.

Copy link
Member

@rozyczko rozyczko left a comment

Choose a reason for hiding this comment

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

some minor issues raised

value = int(value)
# This line can be removed when scipp resize support
# resizing with coordinates
dimensions[dim] = value
Copy link
Member

Choose a reason for hiding this comment

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

You're modifying dimensions in-place, while iterating over its items. This can lead to BAD things. Consider creating a copy of dimensions before and iterating over the copy (or the other way around)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks!

"""Get the Q values from the dataset."""
if self._data is None:
warnings.warn('No data loaded.', UserWarning)
return None
Copy link
Member

Choose a reason for hiding this comment

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

None is not the advertised sc.Variable. Consider changing -> sc.Variable to sc.Variable | None

if self._data is None:
raise ValueError('No data to save.')

import os
Copy link
Member

Choose a reason for hiding this comment

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

Move the import to the top

Copy link
Member Author

@henrikjacobsenfys henrikjacobsenfys Jan 28, 2026

Choose a reason for hiding this comment

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

Top of the file or top of the function? I believe I put it here to only do the import if we're actually saving data, so after input checking :)
Edit: put it at the top of the file

'giving the Experiment an invalid name'
# WHEN / THEN EXPECT
with pytest.raises(TypeError):
experiment.load_hdf5('some_file.h5', name=123)
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't the argument be display_name?

Copy link
Member Author

Choose a reason for hiding this comment

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

It should indeed, I wonder how it passed the test

a model of diffusion
- [Sample model](sample_model.ipynb) – Learn how to create a model of
the scattering from your sample
- [Experiment] (experiment.ipyng) - Learn how to load and bin your data
Copy link
Member

Choose a reason for hiding this comment

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

This should read experiment.ipynb

Copy link
Member Author

Choose a reason for hiding this comment

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

Why can't I react with the 'see no evil' emoji?

import plopp as pp
import scipp as sc

# from easyscience.job.experiment import ExperimentBase
Copy link
Member

Choose a reason for hiding this comment

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

remove commented out code

###########

@staticmethod
def _in_notebook():
Copy link
Member

Choose a reason for hiding this comment

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

this method should probably be typed to return -> bool

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed this and another missing type hint :)

Co-authored-by: Andrew Sazonov <AndrewSazonov@users.noreply.github.com>
@henrikjacobsenfys
Copy link
Member Author

Small suggestion: it would be nice to update the placeholder markdown header cells to use the notebook title and short description I added in the previous PR (and also add one to the new experiment.ipynb). That way the code cells can automatically stretch to the full page width.

Good point, will do this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[priority] medium Normal/default priority [scope] enhancement Adds/improves features (major.MINOR.patch)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants