-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from e-koch/spectral-fitting
Tutorial for basic fitting with a SpectralCube
- Loading branch information
Showing
4 changed files
with
648 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Create the smaller cutouts of the M33 CO and HI cubes to host and | ||
# be available for download online for the tutorials. | ||
|
||
|
||
import astropy.units as u | ||
from spectral_cube import SpectralCube | ||
from pathlib import Path | ||
|
||
# When running, change to the location of the data for `workingdir_co` and `workingdir_hi` | ||
# e.g., | ||
# outputdir = Path("/home/ekoch/ownCloud/code_development/radio_astro_tools/") | ||
# workingdir_co = Path("/home/ekoch/ownCloud/Data/M33/ALMA/") | ||
# workingdir_hi = Path("/home/ekoch/storage/M33/HI/17B-162/") | ||
|
||
# By default, the current directory is used. | ||
|
||
outputdir = Path(".") | ||
|
||
workingdir_co = Path(".") | ||
|
||
workingdir_hi = Path(".") | ||
|
||
# Cut region from the CO(2-1) data cube. | ||
|
||
cube = SpectralCube.read(workingdir_co / "Brick1Tile1_12CO21_0p7kms.image.pbcor_K.fits") | ||
|
||
y, x = 145, 340 | ||
|
||
size = 32 | ||
|
||
cube_cutout = cube[:, y-size:y+size, x-size:x+size] | ||
|
||
cube_cutout.write(outputdir / "M33_ALMA_ACA_12CO21.cutout.fits", overwrite=True) | ||
|
||
# Cutout a similar region from the HI B+C-config cube. | ||
|
||
hi_cube = SpectralCube.read(workingdir_hi / "M33_14B_17B_HI_contsub_width_1kms.image.pbcor.GBT_feathered.fits", use_dask=True) | ||
|
||
hi_cube_cutout = hi_cube.subcube(xlo=cube_cutout.longitude_extrema[1], | ||
xhi=cube_cutout.longitude_extrema[0], | ||
ylo=cube_cutout.latitude_extrema[0], | ||
yhi=cube_cutout.latitude_extrema[1]) | ||
|
||
# Convert to K | ||
hi_cube_cutout = hi_cube_cutout.to(u.K) | ||
|
||
hi_cube_cutout.write(outputdir / "M33_VLA_BCconfig_wGBT_HI.cutout.fits", overwrite=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
numpy | ||
scipy | ||
matplotlib | ||
astropy | ||
aplpy | ||
git+https://github.com/radio-astro-tools/spectral-cube/#egg=spectral-cube | ||
git+https://github.com/radio-astro-tools/radio-beam/#egg=radio-beam | ||
dask[complete] |
Oops, something went wrong.