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 95.91837% with 6 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 95.86% 3 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop      #90   +/-   ##
==========================================
  Coverage           ?   97.50%           
==========================================
  Files              ?       30           
  Lines              ?     1605           
  Branches           ?      268           
==========================================
  Hits               ?     1565           
  Misses             ?       22           
  Partials           ?       18           
Flag Coverage Δ
integration 0.00% <0.00%> (?)
unittests 97.50% <95.91%> (?)

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.

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.

Suggested change
- [Experiment] (experiment.ipyng) - Learn how to load and bin your data
- [Experiment](experiment.ipyng) - Learn how to load and bin your data

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)

"""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

'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?

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

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

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