### Get help on process_image task Source: https://pybdsf.readthedocs.io/en/latest/_sources/ug_basics.rst.txt Example of getting help on the process_image task. ```text help process_image ``` -------------------------------- ### Get help on rms_box parameter Source: https://pybdsf.readthedocs.io/en/latest/_sources/ug_basics.rst.txt Example of getting help on the 'rms_box' parameter. ```text help 'rms_box' ``` -------------------------------- ### Process image with process_image Source: https://pybdsf.readthedocs.io/en/latest/examples.html Assumes an image has already been processed with process_image. This is the starting point for the SAMP examples. ```python BDSF [1]: process_image('VLSS.fits') ... ``` -------------------------------- ### Get help on an input parameter Source: https://pybdsf.readthedocs.io/en/latest/ug_basics.html Use this command to get help on a specific input parameter. The quotes are necessary because parameter names are strings. ```text help '' ``` -------------------------------- ### Start PyBDSF and inspect process_image parameters Source: https://pybdsf.readthedocs.io/en/latest/_sources/ug_basics.rst.txt Interactive PyBDSF session showing the startup banner, available commands/tasks, and the parameter list for the process_image task after issuing 'inp process_image'. Use this to see the default values and descriptions for key parameters such as rms_box, thresh_isl, and thresh_pix. ```console $ pybdsf PyBDSF version 1.1 ======================================================================== PyBDSF commands inp task ............ : Set current task and list parameters par = val ........... : Set a parameter (par = '' sets it to default) Autocomplete (with TAB) works for par and val go .................. : Run the current task default ............. : Set current task parameters to default values tput ................ : Save parameter values tget ................ : Load parameter values PyBDSF tasks process_image ....... : Process an image: find sources, etc. show_fit ............ : Show the results of a fit write_catalog ....... : Write out list of sources to a file export_image ........ : Write residual/model/rms/mean image to a file PyBDSF help help command/task ... : Get help on a command or task (e.g., help process_image) help 'par' .......... : Get help on a parameter (e.g., help 'rms_box') help changelog ...... : See list of recent changes ________________________________________________________________________ BDSF [1]: inp process_image --------> inp(process_image) PROCESS_IMAGE: Find and measure sources in an image. ================================================================================= filename ................. '': Input image file name advanced_opts ........ False : Show advanced options adaptive_rms_box ..... False : Use adaptive rms_box when determining rms and mean maps atrous_do ............ False : Decompose Gaussian residual image into multiple scales beam .................. None : FWHM of restoring beam. Specify as (maj, min, pos ang E of N) in degrees. E.g., beam = (0.06, 0.02, 13.3). None => get from header flagging_opts ........ False : Show options for Gaussian flagging frequency ............. None : Frequency in Hz of input image. E.g., frequency = 74e6. None => get from header. interactive .......... False : Use interactive mode mean_map .......... 'default': Background mean map: 'default' => calc whether to use or not, 'zero' => 0, 'const' => clipped mean, 'map' => use 2-D map multichan_opts ....... False : Show options for multi-channel images output_opts .......... False : Show output options polarisation_do ...... False : Find polarisation properties psf_vary_do .......... False : Calculate PSF variation across image rms_box ............... None : Box size, step size for rms/mean map calculation. Specify as (box, step) in pixels. E.g., rms_box = (40, 10) => box of 40x40 pixels, step of 10 pixels. None => calculate inside program rms_map ............... None : Background rms map: True => use 2-D rms map; False => use constant rms; None => calculate inside program shapelet_do .......... False : Decompose islands into shapelets spectralindex_do ..... False : Calculate spectral indices (for multi-channel image) thresh ................ None : Type of thresholding: None => calculate inside program, 'fdr' => use false detection rate algorithm, 'hard' => use sigma clipping thresh_isl ............. 3.0 : Threshold for the island boundary in number of sigma above the mean. Determines extent of island used for fitting thresh_pix ............. 5.0 : Source detection threshold: threshold for the island peak in number of sigma above the mean. If false detection rate thresholding is used, this value is ignored and thresh_pix is calculated inside the program ``` -------------------------------- ### Start show_fit with broadcast=True Source: https://pybdsf.readthedocs.io/en/latest/examples.html Starts the show_fit task with broadcast=True to highlight the table row corresponding to a source of interest in TOPCAT. The output shows the interactive plot window instructions. ```python BDSF [6]: show_fit(broadcast=T) ======================================================================== NOTE -- With the mouse pointer in plot window: Press "i" ........ : Get integrated flux densities and mean rms values for the visible portion of the image Press "m" ........ : Change min and max scaling values Press "n" ........ : Show / hide island IDs Press "0" ........ : Reset scaling to default Click Gaussian ... : Print Gaussian and source IDs (zoom_rect mode, toggled with the "zoom" button and indicated in the lower right corner, must be off) ________________________________________________________________________ ``` -------------------------------- ### Start PyBDSF interactive shell Source: https://pybdsf.readthedocs.io/en/latest/_sources/ug_basics.rst.txt Launch the PyBDSF interactive shell from a terminal. Requires the interactive shell to be installed (not installed by default). ```bash $ pybdsf ``` -------------------------------- ### Start PyBDSF and set filename Source: https://pybdsf.readthedocs.io/en/latest/examples.html Starts PyBDSF and sets the input image filename to 'VLSS.fits'. The process_image task is automatically current, so no explicit 'inp process_image' is needed. ```text $ pybdsf PyBDSF version 1.7.0 ======================================================================== PyBDSF commands inp task ............ : Set current task and list parameters par = val ........... : Set a parameter (par = '' sets it to default) Autocomplete (with TAB) works for par and val go .................. : Run the current task default ............. : Set current task parameters to default values tput ................ : Save parameter values tget ................ : Load parameter values PyBDSF tasks process_image ....... : Process an image: find sources, etc. show_fit ............ : Show the results of a fit write_catalog ....... : Write out list of sources to a file export_image ........ : Write residual/model/rms/mean image to a file PyBDSF help help command/task ... : Get help on a command or task (e.g., help process_image) help 'par' .......... : Get help on a parameter (e.g., help 'rms_box') help changelog ...... : See list of recent changes ________________________________________________________________________ BDSF [1]: filename='VLSS.fits' ``` -------------------------------- ### Get help on a command or task Source: https://pybdsf.readthedocs.io/en/latest/_sources/ug_basics.rst.txt Use the help command to display help for a command or task. ```text help ``` -------------------------------- ### Get help on a task parameter Source: https://pybdsf.readthedocs.io/en/latest/_sources/ug_basics.rst.txt Use quotes around the parameter name because parameter names are strings. ```text help '' ``` -------------------------------- ### Broadcast show_fit to SAMP with broadcast=True Source: https://pybdsf.readthedocs.io/en/latest/_sources/examples.rst.txt Starts show_fit with broadcast=True to highlight table rows in TOPCAT when clicking Gaussians. The output lists interactive key bindings and mouse actions. ```text BDSF [6]: show_fit(broadcast=T) ======================================================================== NOTE -- With the mouse pointer in plot window: Press "i" ........ : Get integrated flux densities and mean rms values for the visible portion of the image Press "m" ........ : Change min and max scaling Press "n" ........ : Show / hide island IDs Press "0" ........ : Reset scaling to default Click Gaussian ... : Print Gaussian and source IDs (zoom_rect mode, toggled with the "zoom" button and indicated in the lower right corner, must be off) ________________________________________________________________________ ``` -------------------------------- ### Gaussian flagging options list (flagging_opts) Source: https://pybdsf.readthedocs.io/en/latest/process_image.html Lists the Gaussian flagging options shown when flagging_opts is True. Each line gives the parameter name, its default value, and the condition that triggers a flag. Flag values are summed when multiple conditions are met; for example, a Gaussian too large (64) and too bright (2) gets a final flag of 66. ```text flagging_opts ......... True : Show options for Gaussian flagging flag_bordersize ........ 0 : Flag Gaussian if centre is outside border - flag_bordersize pixels flag_maxsize_bm ..... 25.0 : Flag Gaussian if area greater than flag_maxsize_bm times beam area flag_maxsize_isl ..... 1.0 : Flag Gaussian if x, y bounding box around sigma-contour is factor times island bbox flag_maxsnr .......... 1.5 : Flag Gaussian if peak is greater than flag_maxsnr times max value in island flag_minsize_bm ...... 0.7 : Flag Gaussian if flag_smallsrc = True and area smaller than flag_minsize_bm times beam area flag_minsnr .......... 0.9 : Flag Gaussian if peak is less than flag_minsnr times thresh_pix times local rms flag_smallsrc ...... False : Flag sources smaller than flag_minsize_bm times beam area ``` -------------------------------- ### Get help on a command or task Source: https://pybdsf.readthedocs.io/en/latest/ug_basics.html Use this command to get help on a PyBDSF command or task. Replace with the actual name, such as process_image. ```text help ``` -------------------------------- ### Load LOFAR environment module on CEP3 cluster Source: https://pybdsf.readthedocs.io/en/latest/_sources/installation.rst.txt Initializes the environment on the LOFAR CEP3 cluster where PyBDSF is already installed. Run this command before using PyBDSF on that cluster. ```bash $ module load lofim ``` -------------------------------- ### PyBDSF multichannel options list Source: https://pybdsf.readthedocs.io/en/latest/process_image.html Lists the PyBDSF multichannel options shown when `multichan_opts = True`. These options control how a multichannel image is collapsed to form the `ch0` image used for source detection. Defaults and example values are given for each parameter. ```text multichan_opts ........ True : Show options for multi-channel images beam_sp_derive ...... True : If True and beam_spectrum is None, then assume header beam is for lowest frequency and scales with frequency for channels beam_spectrum ....... None : 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., beam_spectrum = [(0.01, 0.01, 45.0), (0.02, 0.01, 34.0)] for two channels. None => all equal to beam collapse_av ........... [] : List of channels to average if collapse_mode = 'average'; None => all collapse_ch0 ........... 0 : Number of the channel for source extraction, if collapse_mode = 'single' collapse_mode ... 'average': Collapse method: 'average' or 'single'. Average channels or take single channel to perform source detection on collapse_wt ....... 'unity': Weighting: 'unity' or 'rms'. Average channels with weights = 1 or 1/rms_clip^2 if collapse_mode = 'average' frequency_sp ........ None : Frequency in Hz of channels in input image when more than one channel is present. E.g., frequency = [74e6, 153e6]. None => get from header ``` -------------------------------- ### Overriding filename in process_image Source: https://pybdsf.readthedocs.io/en/latest/scripting.html Example of using a save file while explicitly overriding the input filename. ```python img = bdsf.process_image('image1_savefile.sav', filename='image2.fits') ``` -------------------------------- ### Open FITS file and run source finder (go) Source: https://pybdsf.readthedocs.io/en/latest/_sources/ug_basics.rst.txt Interactive PyBDSF session: set the filename, run 'go' to process the image, and observe the detailed output including image properties, background statistics, and the number of sources found. ```text BDSF [2]: filename = 'sb48.fits' BDSF [3]: go --------> go() --> Opened 'sb48.fits' Image size .............................. : (256, 256) pixels Number of channels ...................... : 1 Beam shape (major, minor, pos angle) .... : (0.002916, 0.002654, -173.36) degrees Frequency of averaged image ............. : 146.497 MHz Blank pixels in the image ............... : 0 (0.0%) Flux from sum of (non-blank) pixels ..... : 29.565 Jy Derived rms_box (box size, step size) ... : (61, 20) pixels --> Variation in rms image significant --> Using 2D map for background rms --> Variation in mean image significant --> Using 2D map for background mean Min/max values of background rms map .... : (0.05358, 0.25376) Jy/beam Min/max values of background mean map ... : (-0.03656, 0.06190) Jy/beam --> Expected 5-sigma-clipped false detection rate < fdr_ratio --> Using sigma-clipping thresholding Number of islands found ................. : 4 Fitting islands with Gaussians .......... : [====] 4/4 Total number of Gaussians fit to image .. : 12 Total flux in model ..................... : 27.336 Jy Number of sources formed from Gaussians : 6 ``` -------------------------------- ### Run process_image and view output Source: https://pybdsf.readthedocs.io/en/latest/examples.html Runs the process_image task with 'go'. The output shows image statistics, rms/mean map decisions, island count, and interactive plot instructions. ```text BDSF [4]: go ---------> go() --> Opened 'VLSS.fits' Image size .............................. : (1024, 1024) pixels Number of channels ...................... : 1 Number of Stokes parameters ............. : 1 Beam shape (major, minor, pos angle) .... : (0.02222, 0.02222, 0.0) degrees Frequency of image ...................... : 74.000 MHz Number of blank pixels .................. : 0 (0.0%) Flux from sum of (non-blank) pixels ..... : 177.465 Jy Derived rms_box (box size, step size) ... : (196, 65) pixels --> Variation in rms image significant --> Using 2D map for background rms --> Variation in mean image significant --> Using 2D map for background mean Min/max values of background rms map .... : (0.06305, 0.16508) Jy/beam Min/max values of background mean map ... : (-0.01967, 0.01714) Jy/beam --> Expected 5-sigma-clipped false detection rate < fdr_ratio --> Using sigma-clipping thresholding Minimum number of pixels per island ..... : 5 Number of islands found ................. : 115 --> Displaying islands and rms image... ======================================================================== NOTE -- With the mouse pointer in plot window: Press "i" ........ : Get integrated fluxes and mean rms values for the visible portion of the image Press "m" ........ : Change min and max scaling values Press "n" ........ : Show / hide island IDs Press "0" ........ : Reset scaling to default Click Gaussian ... : Print Gaussian and source IDs (zoom_rect mode, toggled with the "zoom" button and indicated in the lower right corner, must be off) ________________________________________________________________________ ``` -------------------------------- ### PyBDSF quick-start: inp process_image, filename, go Source: https://pybdsf.readthedocs.io/en/latest/ug_basics.html Interactive PyBDSF session that sets the input image and runs source finding. The first command shows the process_image parameters and defaults; the second sets the filename and runs go(), which prints the image statistics and fitting results. ```text BDSF [1]: inp process_image --------> inp(process_image) PROCESS_IMAGE: Find and measure sources in an image. ================================================================================= filename ................. '': Input image file name advanced_opts ........ False : Show advanced options adaptive_rms_box ..... False : Use adaptive rms_box when determining rms and mean maps atrous_do ............ False : Decompose Gaussian residual image into multiple scales beam .................. None : FWHM of restoring beam. Specify as (maj, min, pos ang E of N) in degrees. E.g., beam = (0.06, 0.02, 13.3). None => get from header flagging_opts ........ False : Show options for Gaussian flagging frequency ............. None : Frequency in Hz of input image. E.g., frequency = 74e6. None => get from header. interactive .......... False : Use interactive mode mean_map .......... 'default': Background mean map: 'default' => calc whether to use or not, 'zero' => 0, 'const' => clipped mean, 'map' => use 2-D map multichan_opts ....... False : Show options for multi-channel images output_opts .......... False : Show output options polarisation_do ...... False : Find polarisation properties psf_vary_do .......... False : Calculate PSF variation across image rms_box ............... None : Box size, step size for rms/mean map calculation. Specify as (box, step) in pixels. E.g., rms_box = (40, 10) => box of 40x40 pixels, step of 10 pixels. None => calculate inside program rms_map ............... None : Background rms map: True => use 2-D rms map; False => use constant rms; None => calculate inside program shapelet_do .......... False : Decompose islands into shapelets spectralindex_do ..... False : Calculate spectral indices (for multi-channel image) thresh ................ None : Type of thresholding: None => calculate inside program, 'fdr' => use false detection rate algorithm, 'hard' => use sigma clipping thresh_isl ............. 3.0 : Threshold for the island boundary in number of sigma above the mean. Determines extent of island used for fitting thresh_pix ............. 5.0 : Source detection threshold: threshold for the island peak in number of sigma above the mean. If false detection rate thresholding is used, this value is ignored and thresh_pix is calculated inside the program ``` ```text BDSF [2]: filename = 'sb48.fits' BDSF [3]: go --------> go() --> Opened 'sb48.fits' Image size .............................. : (256, 256) pixels Number of channels ...................... : 1 Beam shape (major, minor, pos angle) .... : (0.002916, 0.002654, -173.36) degrees Frequency of averaged image ............. : 146.497 MHz Blank pixels in the image ............... : 0 (0.0%) Flux from sum of (non-blank) pixels ..... : 29.565 Jy Derived rms_box (box size, step size) ... : (61, 20) pixels --> Variation in rms image significant --> Using 2D map for background rms --> Variation in mean image significant --> Using 2D map for background mean Min/max values of background rms map .... : (0.05358, 0.25376) Jy/beam Min/max values of background mean map ... : (-0.03656, 0.06190) Jy/beam --> Expected 5-sigma-clipped false detection rate < fdr_ratio --> Using sigma-clipping thresholding Number of islands found ................. : 4 Fitting islands with Gaussians .......... : [====] 4/4 Total number of Gaussians fit to image .. : 12 Total flux in model ..................... : 27.336 Jy Number of sources formed from Gaussians : 6 ``` -------------------------------- ### List process_image parameters with 'inp process_image' Source: https://pybdsf.readthedocs.io/en/latest/_sources/process_image.rst.txt Run this command in the PyBDSF environment to display the main reduction parameters and their current values. ```text inp process_image ``` -------------------------------- ### process_image output options listing Source: https://pybdsf.readthedocs.io/en/latest/process_image.html Lists the output options for the process_image task when output_opts is True. Shows the default value and a short description for each option, including bbs_patches, indir, outdir, output_all, and savefits_* flags. Use this to see which optional output files can be generated automatically and how to control them. ```text output_opts ........... True : Show output options bbs_patches ......... None : For BBS format, type of patch to use: None => no patches. 'single' => all Gaussians in one patch. 'gaussian' => each Gaussian gets its own patch. 'source' => all Gaussians belonging to a single source are grouped into one patch. 'mask' => use mask file specified by bbs_patches_mask bbs_patches_mask .... None : Name of the mask file (of same size as input image) that defines the patches if bbs_patches = 'mask' indir ............... None : Directory of input FITS files. None => get from filename opdir_overwrite .. 'overwrite': 'overwrite'/'append': If output_all=True, delete existing files or append a new directory outdir .............. None : Directory to use for all output files (including log files). None => parent directory of the input filename output_all ......... False : Write out all files automatically to directory 'outdir/filename_pybdsf' plot_allgaus ....... False : Make a plot of all Gaussians at the end plot_islands ....... False : Make separate plots of each island during fitting (for large images, this may take a long time and a lot of memory) print_timing ....... False : Print basic timing information quiet .............. False : Suppress text output to screen. Output is still sent to the log file as usual savefits_det_meanim False : Save detection background mean image as fits file savefits_det_rmsim . False : Save detection background rms image as fits file savefits_meanim .... False : Save background mean image as fits file savefits_modelim ... False : Save Gaussian model image as fits file savefits_normim .... False : Save norm image as fits file savefits_rankim .... False : Save island rank image as fits file savefits_residim ... False : Save residual image as fits file savefits_rmsim ..... False : Save background rms image as fits file solnname ............ None : Name of the run, to be appended to the name of the output directory verbose_fitting .... False : Print out extra information during fitting ``` -------------------------------- ### Adaptive box options parameter list Source: https://pybdsf.readthedocs.io/en/latest/process_image.html Lists the adaptive box parameters and their defaults. Shows that adaptive_rms_box enables adaptive scaling, adaptive_thresh sets the bright source threshold, and rms_box_bright sets the small-scale box size. ```text adaptive_rms_box ...... True : Use adaptive rms_box when determining rms and mean maps adaptive_thresh ..... None : Sources with pixels above adaptive_thresh* clipped_rms will be considered as bright sources (i.e., with potential artifacts). None => calculate inside program rms_box_bright ...... None : Box size, step size for rms/mean map calculation near bright sources. Specify as (box, step) in pixels. None => calculate inside program ``` -------------------------------- ### Write source catalog to ASCII file Source: https://pybdsf.readthedocs.io/en/latest/_sources/examples.rst.txt Configures and runs the write_catalog task to write the source catalog to an ASCII file. The inp(write_catalog) command displays all task parameters; setting format='ascii' and then running go() writes the catalog to 'VLSS.fits.pybdsf.srl'. The output confirms the file was written. ```text BDSF [6]: inp write_catalog --------> inp(write_catalog) WRITE_CATALOG: Write the Gaussian, source, or shapelet list to a file. ================================================================================ outfile ............... None : Output file name. None => file is named automatically; 'SAMP' => send to SAMP hub (e.g., to TOPCAT, ds9, or Aladin) bbs_patches ........... None : For BBS format, type of patch to use: None => no patches. 'single' => all Gaussians in one patch. 'gaussian' => each Gaussian gets its own patch. 'source' => all Gaussians belonging to a single source are grouped into one patch bbs_patches_mask ...... None : Name of the mask file (of same size as input image) that defines the patches if bbs_patches = 'mask' catalog_type .......... 'srl': Type of catalog to write: 'gaul' - Gaussian list, 'srl' - source list (formed by grouping Gaussians), 'shap' - shapelet list clobber .............. False : Overwrite existing file? correct_proj .......... True : Correct source parameters for image projection (BBS format only)? format ............... 'fits': Format of output catalog: 'bbs', 'ds9', 'fits', 'star', 'kvis', or 'ascii', 'csv', 'casabox', or 'sagecal' incl_chan ............ False : Include flux densities from each channel (if any)? incl_empty ........... False : Include islands without any valid Gaussians (source list only)? srcroot ............... None : Root name for entries in the output catalog. None => use image file name BDSF [7]: format='ascii' BDSF [8]: go ---------> go() --> Wrote ASCII file 'VLSS.fits.pybdsf.srl' ``` -------------------------------- ### PyBDSF write_catalog parameter inspection and execution Source: https://pybdsf.readthedocs.io/en/latest/examples.html Shows the write_catalog task parameters and the commands to set format='ascii' and run go. The output confirms the ASCII file 'VLSS.fits.pybdsf.srl' was written. ```text BDSF [6]: inp write_catalog --------> inp(write_catalog) WRITE_CATALOG: Write the Gaussian, source, or shapelet list to a file. ================================================================================ outfile ............... None : Output file name. None => file is named automatically; 'SAMP' => send to SAMP hub (e.g., to TOPCAT, ds9, or Aladin) bbs_patches ........... None : For BBS format, type of patch to use: None => no patches. 'single' => all Gaussians in one patch. 'gaussian' => each Gaussian gets its own patch. 'source' => all Gaussians belonging to a single source are grouped into one patch bbs_patches_mask ...... None : Name of the mask file (of same size as input image) that defines the patches if bbs_patches = 'mask' catalog_type .......... 'srl': Type of catalog to write: 'gaul' - Gaussian list, 'srl' - source list (formed by grouping Gaussians), 'shap' - shapelet list clobber .............. False : Overwrite existing file? correct_proj .......... True : Correct source parameters for image projection (BBS format only)? format ............... 'fits': Format of output catalog: 'bbs', 'ds9', 'fits', 'star', 'kvis', or 'ascii', 'csv', 'casabox', or 'sagecal' incl_chan ............ False : Include flux densities from each channel (if any)? incl_empty ........... False : Include islands without any valid Gaussians (source list only)? srcroot ............... None : Root name for entries in the output catalog. None => use image file name BDSF [7]: format='ascii' BDSF [8]: go ---------> go() --> Wrote ASCII file 'VLSS.fits.pybdsf.srl' ``` -------------------------------- ### PyBDSF commands overview Source: https://pybdsf.readthedocs.io/en/latest/ug_basics.html Lists the PyBDSF commands and their purposes. Use these commands to manage tasks and parameters interactively. ```text inp task ............ : Set current task and list parameters go .................. : Run the current task default ............. : Set current task parameters to default values tput ................ : Save parameter values tget ................ : Load parameter values ``` -------------------------------- ### List show_fit parameters with inp show_fit Source: https://pybdsf.readthedocs.io/en/latest/show_fit.html Run 'inp show_fit' in PyBDSF to display the full parameter list for the show_fit task. The output shows each parameter with its default value and a brief description. ```text SHOW_FIT: Show results of fit. ================================================================================ broadcast ............ False : Broadcast Gaussian and source IDs and coordinates to SAMP hub when a Gaussian is clicked? ch0_flagged .......... False : Show the ch0 image with flagged Gaussians (if any) overplotted ch0_image ............. True : Show the ch0 image. This is the image used for source detection ch0_islands ........... True : Show the ch0 image with islands and Gaussians (if any) overplotted gmodel_image .......... True : Show the Gaussian model image gresid_image .......... True : Show the Gaussian residual image mean_image ............ True : Show the background mean image pi_image ............. False : Show the polarized intensity image psf_major ............ False : Show the PSF major axis variation psf_minor ............ False : Show the PSF minor axis variation psf_pa ............... False : Show the PSF position angle variation rms_image ............. True : Show the background rms image smodel_image ......... False : Show the shapelet model image source_seds .......... False : Plot the source SEDs and best-fit spectral indices (if image was processed with spectralindex_do = True). Sources may be chosen by ID with the 'c' key or, if ch0_islands = True, by picking a source with the mouse sresid_image ......... False : Show the shapelet residual image ``` -------------------------------- ### Batch process images with PyBDSF (pybdsf_example.py) Source: https://pybdsf.readthedocs.io/en/latest/_sources/examples.rst.txt Use this script to process multiple FITS images with PyBDSF automatically, writing source catalogs and residual images for each. It requires a pre-determined parameter save file (e.g., 'a2256.sav') created with the 'tput' command. For the image 'a2597.fits', it overrides the rms_box to (100,20); for others, it uses the save file and quiet=True. The save file must be the first argument to process_image when used. ```python # pybdsf_example.py # # This script fits a number of images automatically, writing out source # catalogs and residual and model images for each input image. Call it # with "python pybdsf_example.py" import bdsf # Define the list of images to process and the parameter save file input_images = ['a2597.fits', 'a2256_1.fits', 'a2256_2.fits', 'a2256_3.fits', 'a2256_4.fits', 'a2256_5.fits'] save_file = 'a2256.sav' # Now loop over the input images and process them for input_image in input_images: if input_image == 'a2597.fits': # For this one image, run with different parameters. # Note that the image name is the first argument to # process_image: img = bdsf.process_image(input_image, rms_box=(100,20)) else: # For the other images, use the 'a2256.sav` parameter save file. # The quiet argument is used to supress output to the terminal # (it still goes to the log file). # Note: when a save file is used, it must be given first in the # call to process_image: img = bdsf.process_image(save_file, filename=input_image, quiet=True) # Write the source list catalog. File is named automatically. img.write_catalog(format='fits', catalog_type='srl') # Write the residual image. File is named automatically. img.export_image(img_type='gaus_resid') ``` -------------------------------- ### Advanced options parameter list Source: https://pybdsf.readthedocs.io/en/latest/process_image.html Lists the advanced options and their defaults. Shows that advanced_opts enables additional options, aperture sets the aperture radius, aperture_posn positions the aperture, blank_limit blanks pixels below a limit, bmpersrc_th estimates beams per source, and check_outsideuniv checks for pixels outside the universe. ```text advanced_opts ......... True : Show advanced options aperture ............ None : Radius of aperture in pixels inside which aperture fluxes are measured for each source. None => no aperture fluxes measured aperture_posn .. 'centroid': Position the aperture (if aperture is not None) on: 'centroid' or 'peak' of the source. blank_limit ......... None : Limit in Jy/beam below which pixels are blanked. None => no such blanking is done bmpersrc_th ......... None : Theoretical estimate of number of beams per source. None => calculate inside program check_outsideuniv .. False : Check for pixels outside the universe ``` -------------------------------- ### write_catalog task parameters Source: https://pybdsf.readthedocs.io/en/latest/write_catalog.html Lists all parameters for the write_catalog task with their defaults and descriptions. Note that for BBS and SAGECAL formats, output catalogs always use J2000 equinox; coordinates are precessed if the input image has a different equinox. ```text WRITE_CATALOG: Write the Gaussian, source, or shapelet list to a file. ================================================================================ outfile ............... None : Output file name. None => file is named automatically; 'SAMP' => send to SAMP hub (e.g., to TOPCAT, ds9, or Aladin) bbs_patches ........... None : For BBS format, type of patch to use: None => no patches. 'single' => all Gaussians in one patch. 'gaussian' => each Gaussian gets its own patch. 'source' => all Gaussians belonging to a single source are grouped into one patch. 'mask' => use mask file specified by bbs_patches_mask bbs_patches_mask ...... None : Name of the mask file (of same size as input image) that defines the patches if bbs_patches = 'mask' catalog_type .......... 'srl': Type of catalog to write: 'gaul' - Gaussian list, 'srl' - source list (formed by grouping Gaussians), 'shap' - shapelet list (FITS format only) clobber .............. False : Overwrite existing file? correct_proj .......... True : Correct source parameters for image projection (BBS format only)? format ............... 'fits': Format of output Gaussian list: 'bbs', 'ds9', 'fits', 'star', 'kvis', 'ascii', 'csv', 'casabox', or 'sagecal' incl_chan ............ False : Include fluxes from each channel (if any)? incl_empty ........... False : Include islands without any valid Gaussians (source list only)? srcroot ............... None : Root name for entries in the output catalog. None => use image file name ``` -------------------------------- ### PyBDSF show_fit interactive help Source: https://pybdsf.readthedocs.io/en/latest/examples.html Output of the show_fit task, which displays a help message about mouse interactions in the plot window. It lists key bindings: 'i' for integrated fluxes, 'm' for scaling, 'n' for island IDs, '0' for reset, and clicking a Gaussian to print IDs. ```text BDSF [5]: show_fit ---------> show_fit() ======================================================================== NOTE -- With the mouse pointer in plot window: Press "i" ........ : Get integrated fluxes and mean rms values for the visible portion of the image Press "m" ........ : Change min and max scaling values Press "n" ........ : Show / hide island IDs Press "0" ........ : Reset scaling to default Click Gaussian ... : Print Gaussian and source IDs (zoom_rect mode, toggled with the "zoom" button and indicated in the lower right corner, must be off) ________________________________________________________________________ ``` -------------------------------- ### Run show_fit task Source: https://pybdsf.readthedocs.io/en/latest/_sources/examples.rst.txt Invokes the show_fit task to display the fit results in a plot window. The output lists interactive keyboard and mouse controls available in the plot window: press 'i' for integrated fluxes and mean rms values, 'm' to change min/max scaling, 'n' to toggle island IDs, '0' to reset scaling, and click a Gaussian (with zoom_rect mode off) to print Gaussian and source IDs. ```text BDSF [5]: show_fit ---------> show_fit() ======================================================================== NOTE -- With the mouse pointer in plot window: Press "i" ........ : Get integrated fluxes and mean rms values for the visible portion of the image Press "m" ........ : Change min and max scaling values Press "n" ........ : Show / hide island IDs Press "0" ........ : Reset scaling to default Click Gaussian ... : Print Gaussian and source IDs (zoom_rect mode, toggled with the "zoom" button and indicated in the lower right corner, must be off) ________________________________________________________________________ ``` -------------------------------- ### Send source list to SAMP hub with write_catalog Source: https://pybdsf.readthedocs.io/en/latest/examples.html Sends the PyBDSF source list to TOPCAT via SAMP. Requires TOPCAT's SAMP hub to be running. The output confirms the table was sent. ```python BDSF [2]: inp write_catalog BDSF [3]: outfile='SAMP' BDSF [4]: go ---------> go() --> Table sent to SAMP hub. ``` -------------------------------- ### Write catalog to FITS file (write_catalog) Source: https://pybdsf.readthedocs.io/en/latest/_sources/ug_basics.rst.txt Interactive command to write the best-fit Gaussian list to a FITS file. The output file is named 'sb48.pybdsf.srl.fits' and contains source positions, fluxes, etc. ```text BDSF [5]: write_catalog --------> write_catalog() --> Wrote FITS file 'sb48.pybdsf.srl.fits' ``` -------------------------------- ### Polarization module configuration options Source: https://pybdsf.readthedocs.io/en/latest/process_image.html Configuration options for the polarization module. Set polarisation_do to True to enable polarization calculations. pi_fit controls whether the PI image is searched for sources without Stokes I counterparts. pi_thresh_isl and pi_thresh_pix set island and detection thresholds; None values fall back to thresh_isl and thresh_pix respectively. ```text polarisation_do ....... True : Find polarisation properties pi_fit .............. True : Check the polarized intesity (PI) image for sources not found in Stokes I pi_thresh_isl ....... None : Threshold for PI island boundary in number of sigma above the mean. None => use thresh_isl pi_thresh_pix ....... None : Source detection threshold for PI image: threshold for the island peak in number of sigma above the mean. None => use thresh_pix ``` -------------------------------- ### process_image parameter listing output Source: https://pybdsf.readthedocs.io/en/latest/_sources/process_image.rst.txt Output of the 'inp process_image' command showing all main reduction parameters with their defaults and descriptions. ```text PROCESS_IMAGE: Find and measure sources in an image. ================================================================================ :term:`filename` ................. '': Input image file name :term:`adaptive_rms_box` ..... False : Use adaptive rms_box when determining rms and mean maps :term:`advanced_opts` ........ False : Show advanced options :term:`atrous_do` ............ False : Decompose Gaussian residual image into multiple scales :term:`beam` .................. None : FWHM of restoring beam. Specify as (maj, min, pos ang E of N) in degrees. E.g., beam = (0.06, 0.02, 13.3). None => get from header :term:`flagging_opts` ........ False : Show options for Gaussian flagging :term:`frequency` ............. None : Frequency in Hz of input image. E.g., frequency = 74e6. None => get from header. For more than one channel, use the frequency_sp parameter. :term:`interactive` .......... False : Use interactive mode :term:`mean_map` .......... 'default': Background mean map: 'default' => calc whether to use or not, 'zero' => 0, 'const' => clipped mean, 'map' => use 2-D map. :term:`multichan_opts` ....... False : Show options for multi-channel images :term:`output_opts` .......... False : Show output options :term:`polarisation_do` ...... False : Find polarisation properties :term:`psf_vary_do` .......... False : Calculate PSF variation across image :term:`rms_box` ............... None : Box size, step size for rms/mean map calculation. Specify as (box, step) in pixels. E.g., rms_box = (40, 10) => box of 40x40 pixels, step of 10 pixels. None => calculate inside program :term:`rms_map` ............... None : Background rms map: True => use 2-D rms map; False => use constant rms; None => calculate inside program :term:`shapelet_do` .......... False : Decompose islands into shapelets :term:`spectralindex_do` ..... False : Calculate spectral indices (for multi-channel image) :term:`thresh` ................ None : Type of thresholding: None => calculate inside program, 'fdr' => use false detection rate algorithm, 'hard' => use sigma clipping :term:`thresh_isl` ............. 3.0 : Threshold for the island boundary in number of sigma above the mean. Determines extent of island used for fitting :term:`thresh_pix` ............. 5.0 : Source detection threshold: threshold for the island peak in number of sigma above the mean. If false detection rate thresholding is used, this value is ignored and thresh_pix is calculated inside the program ``` -------------------------------- ### export_image task parameters Source: https://pybdsf.readthedocs.io/en/latest/export_image.html Displays the available parameters for the export_image task, including default values and descriptions for file output, format, and image types. ```text EXPORT_IMAGE: Write one or more images to a file. ================================================================================ outfile ............... None : Output file name. None => file is named automatically; 'SAMP' => send to SAMP hub (e.g., to TOPCAT, ds9, or Aladin) clobber .............. False : Overwrite existing file? img_format ........... 'fits': Format of output image: 'fits' or 'casa' img_type ....... 'gaus_resid': Type of image to export: 'gaus_resid', 'shap_resid', 'rms', 'mean', 'gaus_model', 'shap_model', 'ch0', 'pi', 'psf_major', 'psf_minor', 'psf_pa', 'psf_ratio', 'psf_ratio_aper', 'island_mask' mask_dilation ............ 0 : Number of iterations to use for island-mask dilation. 0 => no dilation pad_image ............ False : Pad image (with zeros) to original size ``` -------------------------------- ### Importing PyBDSF Source: https://pybdsf.readthedocs.io/en/latest/scripting.html The initial step to use PyBDSF functionality within a Python script. ```python import bdsf ``` -------------------------------- ### Visualizing fit results with show_fit Source: https://pybdsf.readthedocs.io/en/latest/scripting.html Method to display a summary of the fit, including the input image, islands, Gaussians, model, and residual images. ```python img.show_fit() ``` -------------------------------- ### PyBDSF task list Source: https://pybdsf.readthedocs.io/en/latest/ug_basics.html Lists the four PyBDSF tasks and their one-line purposes. Use this as a quick reference for the available task names. ```text process_image ....... : Process an image: find sources, etc. show_fit ............ : Show the results of a fit write_catalog ....... : Write out list of sources to a file export_image ........ : Write residual/model/rms/mean image to a file ``` -------------------------------- ### Spectral index module options Source: https://pybdsf.readthedocs.io/en/latest/process_image.html Configuration options for the spectral index module. Set spectralindex_do to True to enable spectral index calculation for multi-channel images. flagchan_list flags specific channels before averaging; flagchan_rms and flagchan_snr enable automatic channel flagging based on rms outliers or SNR; specind_maxchan limits channel averaging (0 = no limit, 1 = no averaging); specind_snr sets the target SNR for fitting. ```text spectralindex_do ...... True : Calculate spectral indices (for multi-channel image) flagchan_list ......... [] : List of channels to flag before (averaging and) extracting spectral index flagchan_rms ........ True : Flag channels before (averaging and) extracting spectral index, if their rms if more than 5 (clipped) sigma outside the median rms over all channels, but only if <= 10% of channels flagchan_snr ........ True : Flag channels that do not meet SNR criterion set by specind_snr specind_maxchan ........ 0 : Maximum number of channels to average for a given source when when attempting to meet target SNR. 1 => no averaging; 0 => no maximum specind_snr .......... 3.0 : Target SNR to use when fitting power law. If there is insufficient SNR, neighboring channels are averaged to obtain the target SNR ``` -------------------------------- ### Writing catalogs with write_catalog Source: https://pybdsf.readthedocs.io/en/latest/scripting.html Method to write the Gaussian or source list to a file. ```python img.write_catalog() ``` -------------------------------- ### Enable interactive mode Source: https://pybdsf.readthedocs.io/en/latest/examples.html Sets interactive=T to display islands before fitting, allowing the user to check that they are reasonable. ```text BDSF [3]: interactive=T ``` -------------------------------- ### Export Gaussian model image with export_image Source: https://pybdsf.readthedocs.io/en/latest/_sources/examples.rst.txt Exports the Gaussian model image to a file. The filename is specified explicitly by appending '.model' to the input image name. ```python img.export_image(img_type='gaus_model', outfile=input_image+'.model') ```