Skip to content

Set .conjugate as alias of .conj, #10302 #10303

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

Merged
merged 2 commits into from
May 23, 2025
Merged
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
2 changes: 1 addition & 1 deletion xarray/computation/ops.py
Original file line number Diff line number Diff line change
@@ -283,7 +283,7 @@ def inplace_to_noninplace_op(f):
# _typed_ops.py uses the following wrapped functions as a kind of unary operator
argsort = _method_wrapper("argsort")
conj = _method_wrapper("conj")
conjugate = _method_wrapper("conjugate")
conjugate = _method_wrapper("conj")
round_ = _func_slash_method_wrapper(duck_array_ops.around, name="round")


12 changes: 12 additions & 0 deletions xarray/tests/test_dask.py
Original file line number Diff line number Diff line change
@@ -1822,3 +1822,15 @@ def test_idxmin_chunking():
actual = da.idxmin("time")
assert actual.chunksizes == {k: da.chunksizes[k] for k in ["x", "y"]}
assert_identical(actual, da.compute().idxmin("time"))


def test_conjugate():
# Test for https://github.com/pydata/xarray/issues/10302
z = 1j * da.arange(100)

data = xr.DataArray(z, coords={"x": np.arange(100)})

conj_data = data.conjugate()
assert dask.is_dask_collection(conj_data)

assert_equal(conj_data, data.conj())
Loading
Oops, something went wrong.