punchbowl.level3.velocity#
Functions#
|
Convert y-coordinates of lower and upper row of bands to array indices for slicing. |
|
Normalize and preprocess FITS image by removing bad values and scaling. |
|
Perform cross-correlation for a range of offsets. |
|
Accumulate cross-correlation across frames in a list of FITS files. |
|
Compute speed and sigma for all radial bands. |
|
Process the cross-correlation across frames in a list of FITS files with associated average speeds. |
|
Plot polar maps of the radial flows. |
|
Generate velocity map using flow tracking. |
Module Contents#
- punchbowl.level3.velocity.calc_ylims(ycen_band_rs: numpy.ndarray, r_band_width: float, arcsec_per_px: float) tuple[int, int][source]#
Convert y-coordinates of lower and upper row of bands to array indices for slicing.
- Parameters:
ycen_band_rs (np.ndarray) – y-coordinates of center of band in solar radii
r_band_width (float) – Half-width of each radial band in solar radii
arcsec_per_px (float) – Radial pixel scale in arcsec/px in the polar-remapped images
- Returns:
Lower and upper Numpy array indices of the radial band
- Return type:
list
- punchbowl.level3.velocity.preprocess_image(data: ndcube.NDCube, max_radius_px: int, num_azimuth_bins: int, az_bin: int) numpy.ndarray[source]#
Normalize and preprocess FITS image by removing bad values and scaling.
- Parameters:
data (NDCube) – Input data NDCube
max_radius_px (int) – Maximum radius to include for polar remapping
num_azimuth_bins (int) – Number of azimuthal samples to use in polar remapping
az_bin (int) – Binning factor for binning the polar remapped image over the azimuth. The binning rule is currently numpy.mean()
- Returns:
Preprocecess polar-remapped image
associated metadata
- Return type:
np.ndarray, dict
- punchbowl.level3.velocity.calculate_cross_correlation(image1: numpy.ndarray, image2: numpy.ndarray, offsets: numpy.ndarray, delta_px: int, central_offset: int) numpy.ndarray[source]#
Perform cross-correlation for a range of offsets.
- Parameters:
image1 (np.ndarray) – First image array for correlation
image2 (np.ndarray) – Second, time-offset image array for correlation
offsets (np.ndarray) – Array of pixel offsets to iterate over for cross-correlation
delta_px (int) – Pixel offset increment between samples
central_offset (int) – Central offset from which to start correlation
- Returns:
Accumulated cross-correlation array over all offsets
- Return type:
np.ndarray
- punchbowl.level3.velocity.accumulate_cross_correlation_across_frames(files: list, delta_t: int, sparsity: int, n_ofs: int, max_radius_deg: int, num_azimuth_bins: int, az_bin: int, delta_px: int, central_offset: int) numpy.ndarray[source]#
Accumulate cross-correlation across frames in a list of FITS files.
- Parameters:
files (list) – List of file paths to FITS files
delta_t (int) – Frame offset (in frames) between time-offset image pairs
sparsity (int) – Interval between frames to skip when accumulating cross-correlation
n_ofs (int) – Number of pixel offsets to use in cross-correlation
max_radius_deg (int) – Maximum radius in degrees to include for polar remapping
num_azimuth_bins (int) – Number of azimuthal samples to use in polar remapping
az_bin (int) – Binning factor for binning the polar remapped image over the azimuth. The binning rule is currently numpy.mean()
delta_px (int) – Pixel offset increment between samples
central_offset (int) – Central offset from which to start correlation
- Returns:
Accumulated cross-correlation array over all frames and offsets
- Return type:
np.ndarray
- punchbowl.level3.velocity.compute_all_bands(acc: numpy.ndarray, ycen_band_rs: numpy.ndarray, r_band_half_width: float, arcsec_per_px: float, velocity_azimuth_bins: int, x_kps: numpy.ndarray) tuple[numpy.ndarray, numpy.ndarray][source]#
Compute speed and sigma for all radial bands.
- Parameters:
acc (np.ndarray) – Cross-correlation array accumulated across frames
ycen_band_rs (np.ndarray) – y-coordinates of band centers in solar radii
r_band_half_width (float) – Half-width of each radial band in solar radii
arcsec_per_px (float) – Radial pixel scale in arcsec/px in the polar-remapped images
velocity_azimuth_bins (int) – Number of azimuthal bins in the output flow maps
x_kps (np.ndarray) – Array mapping pixel offsets to speed in km/s
- Returns:
Tuple containing: - np.ndarray : Average speed per angular bin for each radial band - np.ndarray : Sigma (standard deviation) of speed per angular bin for each radial band
- Return type:
tuple
- punchbowl.level3.velocity.process_corr(files: list, arcsec_per_px: float, expected_kps_windspeed: float, delta_t: int, sparsity: int, delta_px: int, ycens: numpy.ndarray, r_band_half_width: float, n_ofs: int, max_radius_deg: int, num_azimuth_bins: int, az_bin: int, velocity_azimuth_bins: int) tuple[numpy.ndarray, numpy.ndarray][source]#
Process the cross-correlation across frames in a list of FITS files with associated average speeds.
- Parameters:
files (list) – List of file paths to FITS files
arcsec_per_px (float) – pixel scale in arcsec over the radial axis in the polar-remapped image
expected_kps_windspeed (float) – Expected Wind Speed in km/s for narrowing the cross-correlation
delta_t (float) – Time offset (in nb of frames) between for an image pair
sparsity (int) – Interval between frames to skip when accumulating cross-correlation
delta_px (int) – Pixel offset increment between samples
ycens (np.ndarray) – y-coordinates of center of bands in solar radii
r_band_half_width (float) – Half-width of each radial band in solar radii
n_ofs (int) – Number of pixel offsets to use in cross-correlation
max_radius_deg (int) – Maximum radius in degrees to include for polar remapping
num_azimuth_bins (int) – Number of azimuthal samples to use in polar remapping
az_bin (int) – Binning factor for binning the polar remapped image over the azimuth. The binning rule is currently numpy.mean()
velocity_azimuth_bins (int) – Number of azimuthal bins in the output flow maps
- Returns:
Average speed and 1-sigma uncertainty over radius and angular bins
- Return type:
[np.ndarray, np.ndarray]
- punchbowl.level3.velocity.plot_flow_map(filename: str | None, data: ndcube.NDCube, cmap: str = 'magma') None[source]#
Plot polar maps of the radial flows.
- Parameters:
filename (str) – Output plot filename. If None, the figure is not saved out.
data (NDCube) – Flow tracking data NDCube
cmap (str, optional) – Colormap for the plot (default is ‘magma’)
- Returns:
The generated Matplotlib Figure
- Return type:
fig
- punchbowl.level3.velocity.track_velocity(files: list[str], delta_t: int = 12, sparsity: int = 2, n_ofs: int = 151, delta_px: int = 2, expected_kps_windspeed: int = 300, r_band_half_width: float = 0.5, max_radius_deg: int = 45, num_azimuth_bins: int = 1440 * 8, az_bin: int = 4, velocity_azimuth_bins: int = 36, ycens: numpy.ndarray | None = None, rbands: list[int] | None = None) ndcube.NDCube[source]#
Generate velocity map using flow tracking.
- Parameters:
files (list[str]) – List of file paths for input data
delta_t (int, optional) – Time offset in frames between images
sparsity (int, optional) – Frame skip interval for averaging
n_ofs (int, optional) – Number of spatial offsets for cross-correlation
delta_px (int, optional) – Pixel offset increment per sample
expected_kps_windspeed (int, optional) – Expected wind speed in km/s
r_band_half_width (float, optional) – Half-width of each radial band in solar radii
max_radius_deg (int, optional) – The maximum radius in degrees
num_azimuth_bins (int, optional) – Number of azimuthal bins in the polar remapped images
az_bin (int, optional) – Binning factor for binning the polar remapped image over the azimuth
velocity_azimuth_bins (int, optional) – Number of azimuthal bins in the output flow maps
ycens (numpy.ndarray, optional) – Radial band centers in solar radii
rbands (list[int], optional) – Indices of radial bands to visualize
- Returns:
The generated velocity map
- Return type:
ndcube.NDCube