Skip to content
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

Fix creation of binary dilation structure in masking and moments tutorial #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions masking_and_moments/masking_and_moments_guide.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
" cache=True, show_progress=True)\n",
"\n",
"# Note that the datafile will not end in \".fits\". Because of that, we need to specify the format\n",
"# When the file name end in \"fits\", `format` will not need to be specified \n",
"# When the file name end in \"fits\", `format` will not need to be specified\n",
"cube = SpectralCube.read(filename, format='fits', use_dask=False)\n",
"\n",
"# Convert to km/s for the spectral unit\n",
Expand Down Expand Up @@ -460,7 +460,7 @@
"\n",
"# Add 1 spectral element on each side of the spatial structure.\n",
"# np.dstack stacks the arrays along a new 3rd dimension:\n",
"structure = np.dstack([structure_spec, structure, structure_spec])\n",
"structure = np.swapaxes(np.dstack([structure_spec, structure, structure_spec]), 0, 2)\n",
"\n",
"signal_mask = nd.binary_dilation(signal_mask, structure=structure, iterations=1)\n"
]
Expand Down Expand Up @@ -956,7 +956,7 @@
"source": [
"with warnings.catch_warnings():\n",
" warnings.simplefilter('ignore')\n",
" \n",
"\n",
" # Load cube\n",
" cube = SpectralCube.read(filename, format='fits', use_dask=True)\n",
" # Convert to km/s for the spectral unit\n",
Expand Down Expand Up @@ -996,10 +996,10 @@
" label_image=low_snr_mask_labels,\n",
" index=range(1, num_labels + 1)) # +1 offset for mask labels\n",
"\n",
" # To preserve the low_snr_mask, we will create a new signal mask where we will remove \n",
" # To preserve the low_snr_mask, we will create a new signal mask where we will remove\n",
" # regions that do not pass the criteria.\n",
" signal_mask = low_snr_mask\n",
" # NOTE: this is memory efficient but may be slower than defining a new empty array and adding the \n",
" # NOTE: this is memory efficient but may be slower than defining a new empty array and adding the\n",
" # (often fewer) number of regions that pass the minimum pixel criteria. See the scipy example\n",
" # above on using this alternative approach.\n",
"\n",
Expand Down
Loading