Skip to content

Commit 1d2d2d5

Browse files
authored
Merge pull request #83 from scipp/upgrade-scn-0.4.2
Upgrade to scippneutron 0.4.2
2 parents 88c18b8 + ffaece1 commit 1d2d2d5

File tree

8 files changed

+19
-19
lines changed

8 files changed

+19
-19
lines changed

conda/meta.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ requirements:
1313
- ipywidgets
1414
- matplotlib
1515
- pooch
16-
- scippneutron>=0.4.1
16+
- scippneutron>=0.4.2
1717
- scipy
1818
- tifffile
1919

@@ -43,7 +43,7 @@ build:
4343
number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
4444
noarch: python
4545
script:
46-
- python setup.py install
46+
- pip install .
4747

4848
about:
4949
home: https://github.com/scipp/ess

docs/instruments/amor/amor_reduction.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@
290290
"q_edges = sc.geomspace(dim='Q', start=0.008, stop=0.08, num=201, unit='1/angstrom')\n",
291291
"sample_q_binned = sc.bin(sample_q, edges=[q_edges])\n",
292292
"sample_q_summed = sample_q_binned.sum('detector_id')\n",
293-
"sc.plot(sample_q_summed[\"wavelength\", 0], norm=\"log\")"
293+
"sc.plot(sample_q_summed, norm=\"log\")"
294294
]
295295
},
296296
{
@@ -354,7 +354,7 @@
354354
"reference_q = reference_wav.transform_coords([\"Q\"], graph=graph)\n",
355355
"reference_q_binned = sc.bin(reference_q, edges=[q_edges])\n",
356356
"reference_q_summed = reference_q_binned.sum('detector_id')\n",
357-
"sc.plot(reference_q_summed[\"wavelength\", 0], norm=\"log\")"
357+
"sc.plot(reference_q_summed, norm=\"log\")"
358358
]
359359
},
360360
{
@@ -372,7 +372,7 @@
372372
"metadata": {},
373373
"outputs": [],
374374
"source": [
375-
"normalized = sample_q_summed[\"wavelength\", 0] / reference_q_summed[\"wavelength\", 0]\n",
375+
"normalized = sample_q_summed / reference_q_summed\n",
376376
"sc.plot(normalized, norm=\"log\")"
377377
]
378378
},

ess-developer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ channels:
77

88
dependencies:
99
# Build
10-
- scippneutron>=0.4.1
10+
- scippneutron>=0.4.2
1111
- gitpython
1212

1313
# Run

src/ess/sans/reduction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ def reduce_to_q(data, *, q_bins, reducer, wavelength_bands=None):
3030
high = wavelength_bands['wavelength', i + 1]
3131
band = sc.histogram(data['wavelength', low:high], q_bins)
3232
band = reducer(band)
33-
bands = sc.concatenate(bands, band, 'wavelength') if bands is not None else band
33+
bands = sc.concat([bands, band], 'wavelength') if bands is not None else band
3434
bands.coords['wavelength'] = wavelength_bands
3535
return bands

src/ess/v20/imaging/operations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ def _shift(var, dim, forward, out_of_bounds):
88
fill = var[dim, 0:1].copy()
99
fill.values = np.full_like(fill.values, out_of_bounds)
1010
if forward:
11-
return sc.concatenate(fill, var[dim, :-1], dim)
11+
return sc.concat([fill, var[dim, :-1]], dim)
1212
else:
13-
return sc.concatenate(var[dim, 1:], fill, dim)
13+
return sc.concat([var[dim, 1:], fill], dim)
1414

1515

1616
def mask_from_adj_pixels(mask):
@@ -47,7 +47,7 @@ def make_flip(fill):
4747
shape=[
4848
8,
4949
] + mask.shape,
50-
dtype=sc.dtype.bool)
50+
dtype=bool)
5151
flip['neighbor', 0] = _shift(mask, "x", True, fill)
5252
flip['neighbor', 1] = _shift(mask, "x", False, fill)
5353
flip['neighbor', 2] = _shift(mask, "y", True, fill)

src/ess/wfm/stitch.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ def _stitch_dense_data(item: sc.DataArray, frames: sc.Dataset, dim: str, new_dim
5757
def _stitch_event_data(item: sc.DataArray, frames: sc.Dataset, dim: str, new_dim: str,
5858
bins: Union[int, sc.Variable]) -> Union[sc.DataArray, dict]:
5959

60-
edges = sc.flatten(sc.transpose(sc.concatenate(frames["time_min"].data,
61-
frames["time_max"].data, 'dummy'),
60+
edges = sc.flatten(sc.transpose(sc.concat(
61+
[frames["time_min"].data, frames["time_max"].data], 'dummy'),
6262
dims=['frame', 'dummy']),
6363
to=dim)
6464

@@ -76,12 +76,12 @@ def _stitch_event_data(item: sc.DataArray, frames: sc.Dataset, dim: str, new_dim
7676
erase = [dim]
7777

7878
binned.masks['frame_gaps'] = (sc.arange(dim, 2 * frames.sizes["frame"] - 1) %
79-
2).astype(sc.dtype.bool)
79+
2).astype(bool)
8080

81-
new_edges = sc.concatenate(
81+
new_edges = sc.concat([
8282
(frames["time_min"]["frame", 0] - frames["time_correction"]["frame", 0]).data,
83-
(frames["time_max"]["frame", -1] - frames["time_correction"]["frame", -1]).data,
84-
new_dim)
83+
(frames["time_max"]["frame", -1] - frames["time_correction"]["frame", -1]).data
84+
], new_dim)
8585
return sc.bin(binned, edges=[new_edges], erase=erase)
8686

8787

src/ess/wfm/tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ def to_bin_edges(x: sc.Variable, dim: str) -> sc.Variable:
2121
idim = x.dims.index(dim)
2222
if x.shape[idim] < 2:
2323
one = 1.0 * x.unit
24-
return sc.concatenate(x[dim, 0:1] - one, x[dim, 0:1] + one, dim)
24+
return sc.concat([x[dim, 0:1] - one, x[dim, 0:1] + one], dim)
2525
else:
2626
center = to_bin_centers(x, dim)
2727
# Note: use range of 0:1 to keep dimension dim in the slice to avoid
2828
# switching round dimension order in concatenate step.
2929
left = center[dim, 0:1] - (x[dim, 1] - x[dim, 0])
3030
right = center[dim, -1] + (x[dim, -1] - x[dim, -2])
31-
return sc.concatenate(sc.concatenate(left, center, dim), right, dim)
31+
return sc.concat([left, center, right], dim)

tests/v20/groupby2d_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def test_simple_case_any_naming():
4343
grouped = groupby2D(ds, nx_target=5, ny_target=5, x='w', y='v', z='u')
4444
assert grouped['a'].shape == [2, 5, 5]
4545
projection = sc.array(dims=['v', 'w'], values=np.ones((5, 5))) * 4
46-
expected_data = sc.concatenate(projection, projection, dim='u')
46+
expected_data = sc.concat([projection, projection], dim='u')
4747
assert sc.all(
4848
sc.isclose(grouped['a'].data, expected_data, atol=1e-14 * sc.units.one)).value
4949

0 commit comments

Comments
 (0)