utils.py
This module contains utility functions used by the image ingestion section of the pipeline.
calc_condon_flux_errors(row, theta_B, theta_b, alpha_maj1=2.5, alpha_min1=0.5, alpha_maj2=0.5, alpha_min2=2.5, alpha_maj3=1.5, alpha_min3=1.5, clean_bias=0.0, clean_bias_error=0.0, frac_flux_cal_error=0.0)
¶
The following code for this function taken from the TraP with a few modifications.
Returns the errors on parameters from Gaussian fits according to the Condon (PASP 109, 166 (1997)) formulae. These formulae are not perfect, but we'll use them for the time being. (See Refregier and Brown (astro-ph/9803279v1) for a more rigorous approach.) It also returns the corrected peak. The peak can be corrected for the overestimate due to the local noise gradient, but this is currently not used in the function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row | Series | The row containing the component information from the Selavy component catalogue. | required |
theta_B | float | The major axis size of the restoring beam of the image (degrees). | required |
theta_b | float | The minor axis size of the restoring beam of the image (degrees). | required |
alpha_maj1 | float | The alpha_M exponent value for x_0. | 2.5 |
alpha_min1 | float | The alpha_m exponent value for x_0. | 0.5 |
alpha_maj2 | float | The alpha_M exponent value for y_0. | 0.5 |
alpha_min2 | float | The alpha_m exponent value for y_0. | 2.5 |
alpha_maj3 | float | The alpha_M exponent value for the amplitude error. | 1.5 |
alpha_min3 | float | The alpha_m exponent value for the amplitude error. | 1.5 |
clean_bias | float | Clean bias value used in the peak flux correction (not currently used). | 0.0 |
clean_bias_error | float | The error of the clean bias value used in the peak flux correction (not currently used). | 0.0 |
frac_flux_cal_error | float | Flux calibration error value. (Unsure of exact meaning, refer to TraP). | 0.0 |
Returns:
Type | Description |
---|---|
float | Peak flux error (Jy). |
float | Integrated flux error (Jy). |
float | Major axis error (deg). |
float | Minor axis error (deg). |
float | Position angle error (deg). |
float | Right ascension error (deg). |
float | Declination error (deg). |
Source code in vast_pipeline/image/utils.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
|
calc_error_radius(ra, ra_err, dec, dec_err)
¶
Using the fitted errors from selavy, this function estimates the largest on sky angular size of the uncertainty. The four different combinations of the errors are analysed and the maximum is returned. Logic is taken from the TraP, where this is also used. Function has been vectorised for pandas. All inputs are in degrees.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ra | float | The right ascension of the coordinate (degrees). | required |
ra_err | float | The error associated with the ra value (degrees). | required |
dec | float | The declination of the coordinate (degrees). | required |
dec_err | float | The error associated with the declination value (degrees). | required |
Returns:
Type | Description |
---|---|
float | The calculated error radius (degrees). |
Source code in vast_pipeline/image/utils.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
|
on_sky_sep(ra_1, ra_2, dec_1, dec_2)
¶
Simple on sky distance between two RA and Dec coordinates. Needed for fast calculation on dataframes as astropy is slow. All units are radians.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ra_1 | float | The right ascension of coodinate 1 (radians). | required |
ra_2 | float | The right ascension of coodinate 2 (radians). | required |
dec_1 | float | The declination of coodinate 1 (radians). | required |
dec_2 | float | The declination of coodinate 2 (radians). | required |
Returns:
Type | Description |
---|---|
float | The on-sky separation distance between the two coodinates (radians). |
Source code in vast_pipeline/image/utils.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
|
open_fits(fits_path, memmap=True)
¶
This function opens both compressed and uncompressed fits files.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fits_path | Union[str, Path] | Path to the fits file | required |
memmap | Optional[bool] | Open the fits file with mmap. | True |
Returns:
Type | Description |
---|---|
HDUList loaded from the fits file |
Source code in vast_pipeline/image/utils.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
|