Skip to content

Commit

Permalink
Merge pull request #12 from miguelcarcamov/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
miguelcarcamov authored Nov 2, 2022
2 parents 7b8c9b9 + f0986ae commit 04f6f24
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publishpypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
python-version: '3.8'
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip wheel setuptools setuptools-scm
Expand Down
36 changes: 19 additions & 17 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
name: pyralysis-env
name: snow-env
dependencies:
- python>=3.8, <3.8.10
- numpy=1.22.4
- python=3.8
- numpy=1.23
- mpi4py
- anaconda
- pip
- pip:
- almatasks==1.5.2
- astropy==5.1
- casadata==2022.9.5
- casampi==0.5.01
- casaplotms==1.8.7
- casaplotserver==1.4.6
- casashell==6.5.2.26
- casatasks==6.5.2.26
- casatestutils==6.5.2.26
- casatools==6.5.2.26
- casaviewer==1.6.6
- reproject==0.9
- scipy==1.8.1
- git+https://gitlab.com/miguelcarcamov/pyralysis@development#egg=pyralysis
- almatasks==1.5.2
- astropy==5.1
- casadata==2022.9.5
- casampi==0.5.01
- casaplotms==1.8.7
- casaplotserver==1.4.6
- casashell==6.5.2.26
- casatasks==6.5.2.26
- casatestutils==6.5.2.26
- casatools==6.5.2.26
- casaviewer==1.6.6
- reproject==0.9.1
- scipy==1.9.1
- python-casacore==3.5.2
- git+https://gitlab.com/miguelcarcamov/pyralysis@development#egg=pyralysis
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools>=62.6.0", "setuptools-scm", "wheel"]
requires = ["setuptools>=65.5.0", "setuptools-scm", "wheel"]
build-backend = "setuptools.build_meta"

[project]
Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ casatasks==6.5.2.26
casatestutils==6.5.2.26
casatools==6.5.2.26
casaviewer==1.6.6
mpi4py==3.1.3
numpy==1.23
git+https://gitlab.com/miguelcarcamov/pyralysis@development#egg=pyralysis
reproject==0.9
python-casacore==3.5.2
reproject==0.9.1
scipy==1.9.1
14 changes: 9 additions & 5 deletions src/snow/imaging/gpuvmem.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,25 +269,29 @@ def __restore_pyra(
hermitian_symmetry=hermitian_symmetry,
padding_factor=padding_factor
)
image = dirty_mapper.transform()[0].data[0].compute()
residual_image = dirty_mapper.transform()[0].data[0].compute()

fits_io.write(image, output_name=residual_casa_image + ".fits")
fits_io.write(residual_image, output_name=residual_casa_image + ".fits")

psf = dataset.psf[0]

clean_beam_kernel = psf.as_kernel(pix_scale)

im_model_convolved = convolve_fft(im_model.squeeze(), clean_beam_kernel)
im_model_convolved = convolve_fft(
im_model.squeeze(),
clean_beam_kernel.array.astype(np.float32),
complex_dtype=np.complex64
).astype(np.float32)

pixel_area = np.abs(pix_scale * pix_scale)
pix_area_scale = u.pixel_scale(pixel_area / u.pixel)
beam_area_pixels = psf.sr.to(u.pixel, pix_area_scale)

im_model_convolved *= beam_area_pixels.value

im_restored = im_model_convolved + image
im_restored = im_model_convolved + residual_image

fits_io.write(im_restored, output_name=restored_image + ".fits")
fits_io.write(im_restored.astype(np.float32), output_name=restored_image + ".fits")

return residual_casa_image + ".fits", restored_image + ".fits"

Expand Down

0 comments on commit 04f6f24

Please sign in to comment.