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 issue with frequency_sp being ignored #219

Merged
merged 2 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 10 additions & 0 deletions bdsf/collapse.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ def __call__(self, img):
if pol == 'I':
ch0 = img.image_arr[0, chan0]
img.ch0_arr = ch0

# Construct weights so that desired channel has weight of 1 and all
# others have weight of 0. The init_freq_collapse function will then
# select the intended frequency
c_list = img.opts.collapse_av
if c_list == []:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to write this as: if not c_list:

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion. In fact, I see now that much of the new code I added is redundant, as many of the same things are done a bit earlier. So I removed some of the new stuff and refactored the existing code a bit.

c_list = N.arange(img.image_arr.shape[1])
wtarr = N.zeros(len(c_list))
wtarr[chan0] = 1.0
gmloose marked this conversation as resolved.
Show resolved Hide resolved
init_freq_collapse(img, wtarr)
mylogger.userinfo(mylog, 'Source extraction will be ' \
'done on channel', '%i (%.3f MHz)' % \
(chan0, img.frequency/1e6))
Expand Down
5 changes: 5 additions & 0 deletions bdsf/psf_vary.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ def __call__(self, img):
mylog.warning('PyFITS version is too old: psf_vary module skipped')
return

if img.nisl == 0:
mylog.warning("No islands found. Skipping PSF variation estimation.")
img.completed_Ops.append('psf_vary')
return

if opts.psf_fwhm is not None:
# User has specified a constant PSF to use, so skip PSF fitting/etc.
psf_maj = opts.psf_fwhm[0] # FWHM in deg
Expand Down
5 changes: 5 additions & 0 deletions bdsf/shapefit.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ def __call__(self, img):
bar = statusbar.StatusBar('Decomposing islands into shapelets ...... : ', 0, img.nisl)
opts = img.opts
if img.opts.shapelet_do:
if img.nisl == 0:
mylog.warning("No islands found. Skipping shapelet decomposition.")
img.completed_Ops.append('shapelets')
return

if not opts.quiet:
bar.start()

Expand Down
9 changes: 9 additions & 0 deletions doc/source/process_image.rst
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,10 @@ The options concerning multichannel images are:
scale accordingly to calculate the beam per channel. If ``False``, then a
constant value of the beam (that given in the header or specified with the ``beam`` parameter) is taken instead.

.. note::

This parameter is used only in the :ref:`spectralindex_do` module.

beam_spectrum
This parameter is a list of tuples (default is ``None``) that sets the FWHM of synthesized beam per channel. Specify as [(bmaj_ch1, bmin_ch1,
bpa_ch1), (bmaj_ch2, bmin_ch2, bpa_ch2), etc.] in degrees. E.g.,
Expand All @@ -894,6 +898,11 @@ The options concerning multichannel images are:
If not found, the beam is either assumed to be a constant or to scale with frequency,
depending on whether the parameter ``beam_sp_derive`` is ``False`` or ``True``.

.. note::

This parameter is used only in the :ref:`spectralindex_do` module. For normal fitting (outside of the spectral index module), a
constant value of the beam (that given in the header or specified with the ``beam`` parameter) is taken instead.

collapse_av
This parameter is a list of integers (default is ``[]``) that specifies the channels to be averaged to produce the
continuum image for performing source extraction, if ``collapse_mode`` is
Expand Down
Loading