-
Notifications
You must be signed in to change notification settings - Fork 27
Closed
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
Describe the bug
Due to the way intensities is implemented as a property with a setter, some weird behavior can occur due to the direct beam mask.
Similar issues can be created with the coordinates attribute.
To Reproduce
from diffsims.sims.diffraction_simulation import DiffractionSimulation
coords = np.array([[0, 0], [1, 1], [2, 3]])
intensities = np.array([1, 1, 3])
sim = DiffractionSimulation(coordinates = coords, intensities = intensities, with_direct_beam=False)
sim.intensities = sim.intensities
# now throws an error because intensities is of the wrong shape
sim.intensitiesExpected behavior
The setter needs to be more restrictive so that not just any array can be used, which creates inconsistencies.
I propose to check the size of the passed arrays and modify behavior depending on whether with_direct_beam is on or not.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working