From e78313fd48cadc576fa60cf68bf6946137730796 Mon Sep 17 00:00:00 2001 From: Akio Taniguchi <13254278+astropenguin@users.noreply.github.com> Date: Wed, 22 Oct 2025 03:27:33 +0000 Subject: [PATCH 1/2] #211 Calculate sample-number-based weights in make.cube --- decode/make.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/decode/make.py b/decode/make.py index 1cdee06..9144c04 100644 --- a/decode/make.py +++ b/decode/make.py @@ -33,7 +33,8 @@ def cube( skycoord_units: Units of the sky coordinate axes. Returns: - Cube DataArray. + Cube DataArray. The weight coordinate is the inverse + variance of the input DEMS samples within each pixel. """ dems = convert.coord_units(dems, "lon", "deg") @@ -56,14 +57,20 @@ def cube( dems = dems.copy(data=dems.data) dems.coords.update({"index": index}) - gridded = dems.groupby("index").mean("time") + mean = dems.groupby("index").mean("time") + var = dems.groupby("index").var("time") data = np.full([n_lat * n_lon, n_chan], np.nan) - data[gridded.index.values] = gridded.values + data[mean.index.values] = mean.values data = data.reshape(n_lat, n_lon, n_chan).transpose(2, 0, 1) + weight = np.full([n_lat * n_lon, n_chan], np.nan) + weight[var.index.values] = 1 / var.values + weight = weight.reshape(n_lat, n_lon, n_chan).transpose(2, 0, 1) + cube = Cube.new( data=data, + weight=weight, lat=lat, lon=lon, chan=dems.chan, From ca980d10b5958cb957d8edce3a603eef021dc148 Mon Sep 17 00:00:00 2001 From: Akio Taniguchi <13254278+astropenguin@users.noreply.github.com> Date: Wed, 22 Oct 2025 03:40:10 +0000 Subject: [PATCH 2/2] =?UTF-8?q?#211=20Update=20package=20version=20(2025.8?= =?UTF-8?q?.0=20=E2=86=92=202025.10.0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CITATION.cff | 2 +- README.md | 2 +- decode/__init__.py | 2 +- pyproject.toml | 2 +- uv.lock | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index 8e43a96..ab7f40f 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -33,5 +33,5 @@ keywords: - spectroscopy - submillimeter license: MIT -version: 2025.8.0 +version: 2025.10.0 date-released: '2025-08-18' diff --git a/README.md b/README.md index 36bea73..a404d3d 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ DESHIMA code for data analysis ## Installation ```shell -pip install decode==2025.8.0 +pip install decode==2025.10.0 ``` ## Quick look diff --git a/decode/__init__.py b/decode/__init__.py index 778e381..00bf3b0 100644 --- a/decode/__init__.py +++ b/decode/__init__.py @@ -11,7 +11,7 @@ "stats", "utils", ] -__version__ = "2025.8.0" +__version__ = "2025.10.0" # submodules diff --git a/pyproject.toml b/pyproject.toml index e908458..2ce174b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "decode" -version = "2025.8.0" +version = "2025.10.0" description = "DESHIMA code for data analysis" readme = "README.md" keywords = [ diff --git a/uv.lock b/uv.lock index 407cac0..a35e5f9 100644 --- a/uv.lock +++ b/uv.lock @@ -535,7 +535,7 @@ wheels = [ [[package]] name = "decode" -version = "2025.8.0" +version = "2025.10.0" source = { editable = "." } dependencies = [ { name = "astropy", version = "6.0.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" },