Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion prose/fluxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def diff(self, comps: np.ndarray = None):
differential :code:`Fluxes`
"""
if comps is not None:
weights = np.zeros(self.fluxes[0:2])
weights = np.zeros(self.fluxes.shape[0:-1])
weights[:, comps] = 1
else:
weights = None
Expand All @@ -335,6 +335,7 @@ def diff(self, comps: np.ndarray = None):
diff_fluxes, diff_errors = diff(self.fluxes, weights, self.errors)
_new.fluxes = diff_fluxes
_new.errors = diff_errors
_new.aperture = _new.best_aperture_index()

return _new

Expand Down
10 changes: 9 additions & 1 deletion tests/test_fluxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,16 @@ def test_3d():
f.error


def test_diff():
def test_auto_diff():
x = np.random.uniform(0, 10000, size=(3, 2, 10))
f = Fluxes(x)
f.target = 1
diff = f.autodiff()


def test_diff():
x = np.random.uniform(0, 10000, size=(30, 20, 10))
comps = np.repeat(np.array([[1, 12, 16]]), repeats=30, axis=0)
f = Fluxes(x)
f.target = 1
diff = f.autodiff()