Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
540cf70
AntennaSurface class now passes the dish outer limit rather than its …
vsmagalhaes Feb 18, 2025
4d60cf2
Implemented support for arm shadows with different widths for differe…
vsmagalhaes Feb 18, 2025
d3134cd
Added minimal documentation to create_aperture_mask in algorithms.py
vsmagalhaes Feb 18, 2025
3c28c72
Added a _save_to_dist method to the Telescope class so that modificat…
vsmagalhaes Feb 18, 2025
c24a158
Added staggered arm shadows for the VLA telescope file.
vsmagalhaes Feb 18, 2025
1ae4d1e
Brought in fits comparison CL tool into astrohack, it needs heavy rev…
vsmagalhaes Feb 18, 2025
4a5a139
Added missing docstrings in fits.py
vsmagalhaes Feb 18, 2025
240e2d8
Removed obviously redundant Ad hoc solutions from image_compare_tool.py
vsmagalhaes Feb 18, 2025
9c1a3fd
Renamed some FITS routines for clearer semantics.
vsmagalhaes Feb 20, 2025
a617bd4
Moved get_axis_from_fits_header to utils/fits.py
vsmagalhaes Feb 20, 2025
c092161
Added a simple tool to compare axes
vsmagalhaes Feb 20, 2025
8c0c8ea
Implemented comparison methods and plotting
vsmagalhaes Feb 20, 2025
1a41a04
Evolved FITS reading and writing.
vsmagalhaes Feb 20, 2025
7b7faa5
Changed value of none clippign to the smallest value in amplitude to …
vsmagalhaes Feb 20, 2025
b967237
Commented out execution code, simplified reading.
vsmagalhaes Feb 20, 2025
2cda2d8
Added a function for safe retrieval of keywords from headers/dictiona…
vsmagalhaes Feb 21, 2025
829fd2a
Added a function to retrieve which of the axis is the stokes axis.
vsmagalhaes Feb 21, 2025
d097464
Improved reading of input images
vsmagalhaes Feb 21, 2025
9b4dd68
Added control over pixel_offset being applied
vsmagalhaes Feb 21, 2025
6d29d73
Fixed data ordering and adapted axis reading
vsmagalhaes Feb 21, 2025
fd2fa83
Added xds export
vsmagalhaes Feb 21, 2025
373270d
Added the option to read a FITS header as a python dictionary
vsmagalhaes Feb 21, 2025
b1ad5ca
Factorised mask creation, added read and write to Zarr and a print me…
vsmagalhaes Feb 21, 2025
22ba437
Input file name is preserved when reading a .zarr container.
vsmagalhaes Feb 25, 2025
2322c58
Added storage of original data and axes description
vsmagalhaes Feb 25, 2025
713ad06
Made FITS write more general
vsmagalhaes Feb 25, 2025
8caf278
Added method to export to FITS
vsmagalhaes Feb 25, 2025
42eb85f
Cleanup
vsmagalhaes Feb 25, 2025
16a04bb
Minor documentation.
vsmagalhaes Feb 26, 2025
a4aebb2
Added a method to create a scatter plot against the reference image
vsmagalhaes Feb 26, 2025
9dc627b
Added capability to plot a linear regression together with a scatter …
vsmagalhaes Feb 26, 2025
9585fba
Small change in formating
vsmagalhaes Feb 26, 2025
4bca3fd
Plotting improvements
vsmagalhaes Feb 26, 2025
27966f3
Minor issues
vsmagalhaes Feb 26, 2025
5d5755b
Added a chunk execution method
vsmagalhaes Feb 26, 2025
f7489b4
Added frontend version and improved chunk function
vsmagalhaes Feb 26, 2025
3c484f1
Some progress towards controlling the image comparison tool
vsmagalhaes Feb 26, 2025
2b62f56
Added a new graph execution function
vsmagalhaes Feb 26, 2025
70ac9c8
Added creation of a datatree to disk.
vsmagalhaes Feb 26, 2025
5e4516c
Renaming
vsmagalhaes Feb 27, 2025
a6a7bab
Created class methods for proper initialization.
vsmagalhaes Feb 27, 2025
76e88d6
Documentation for FITSImage class
vsmagalhaes Feb 27, 2025
b04278a
Further backend documentation.
vsmagalhaes Feb 27, 2025
a6ffb15
Frontend documentation and added DataTree return.
vsmagalhaes Feb 27, 2025
c94d4e7
Added image comparison tool to defautl astrohack import.
vsmagalhaes Feb 27, 2025
5786bcf
Added image comparison tool to API.
vsmagalhaes Feb 27, 2025
742ecf5
Changes in format for documentation
vsmagalhaes Feb 27, 2025
4ebbf68
Changes in format for documentation
vsmagalhaes Feb 27, 2025
4f1c692
Changes in format for documentation
vsmagalhaes Feb 27, 2025
8d04fee
Changes in format for documentation
vsmagalhaes Feb 27, 2025
23a9403
Added parameter checking for image comparison tool
vsmagalhaes Feb 27, 2025
d4820e6
Updated reference values in test_panel.py and test_class_antenna_surf…
vsmagalhaes Feb 27, 2025
abe134d
Updated reference values in test_stakeholder_vla.py
vsmagalhaes Feb 27, 2025
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
1 change: 1 addition & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ Under development.
_api/autoapi/astrohack/extract_locit/index
_api/autoapi/astrohack/locit/index
_api/autoapi/astrohack/cassegrain_ray_tracing/index
_api/autoapi/astrohack/image_comparison_tool/index
1 change: 1 addition & 0 deletions src/astrohack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from .locit import *
from .extract_locit import *
from .cassegrain_ray_tracing import *
from .image_comparison_tool import *

# This installs a slick, informational tracebacks logger
from rich.traceback import install
Expand Down
12 changes: 6 additions & 6 deletions src/astrohack/antenna/antenna_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from astrohack.visualization.plot_tools import well_positioned_colorbar, create_figure_and_axes, close_figure, \
get_proper_color_map

from astrohack.utils.fits import write_fits, resolution_to_fits_header, axis_to_fits_header
from astrohack.utils.fits import write_fits, put_resolution_in_fits_header, put_axis_in_fits_header

lnbr = "\n"
SUPPORTED_POL_STATES = ['I', 'RR', 'LL', 'XX', 'YY']
Expand Down Expand Up @@ -172,7 +172,7 @@ def _read_xds(self, inputxds):
def _define_amp_clip(self, clip_type, clip_level):
self.amplitude_noise = np.where(self.base_mask, np.nan, self.amplitude)
if clip_type is None or clip_type == 'none':
clip = -np.inf
clip = np.nanmin(self.amplitude)
elif clip_type == 'relative':
clip = clip_level * np.nanmax(self.amplitude)
elif clip_type == 'absolute':
Expand Down Expand Up @@ -303,7 +303,7 @@ def _create_aperture_mask(self, clip_type, clip_level, exclude_shadows):
arm_angle = 0.0

self.base_mask, self.rad, self.phi = create_aperture_mask(self.u_axis, self.v_axis, self.telescope.inlim,
self.telescope.diam/2,
self.telescope.oulim,
arm_width=arm_width,
arm_angle=arm_angle,
return_polar_meshes=True)
Expand Down Expand Up @@ -865,9 +865,9 @@ def export_to_fits(self, basename):
'WAVELENG': self.wavelength,
'FREQUENC': clight / self.wavelength,
}
head = axis_to_fits_header(head, self.u_axis, 1, 'X----LIN', 'm')
head = axis_to_fits_header(head, self.v_axis, 2, 'Y----LIN', 'm')
head = resolution_to_fits_header(head, self.resolution)
head = put_axis_in_fits_header(head, self.u_axis, 1, 'X----LIN', 'm')
head = put_axis_in_fits_header(head, self.v_axis, 2, 'Y----LIN', 'm')
head = put_resolution_in_fits_header(head, self.resolution)

write_fits(head, 'Amplitude', self.amplitude, add_prefix(basename, 'amplitude') + '.fits', self.amp_unit,
'panel')
Expand Down
18 changes: 14 additions & 4 deletions src/astrohack/antenna/telescope.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,19 @@ def write(self, filename):
Args:
filename: Name of the output file
"""
ledict = vars(self)
obj_dict = vars(self)
xds = xr.Dataset()
xds.attrs = ledict
xds.attrs = obj_dict
xds.to_zarr(filename, mode="w", compute=True, consolidated=True)
return

def _save_to_dist(self):
obj_dict = vars(self)
filename = f'{self.filepath}/{self.filename}'
obj_dict.pop('filepath', None)
obj_dict.pop('filename', None)
xds = xr.Dataset()
xds.attrs = obj_dict
xds.to_zarr(filename, mode="w", compute=True, consolidated=True)
return

Expand All @@ -139,7 +149,7 @@ def print(self):

def __repr__(self):
outstr = ''
ledict = vars(self)
for key, item in ledict.items():
obj_dict = vars(self)
for key, item in obj_dict.items():
outstr += f"{key:20s} = {str(item)}\n"
return outstr
85 changes: 85 additions & 0 deletions src/astrohack/config/image_comparison_tool.param.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"compare_fits_images":{
"image":{
"nullable": false,
"required": true,
"struct_type": ["str"],
"type": ["string", "list"]
},
"reference_image":{
"nullable": false,
"required": true,
"struct_type": ["str"],
"type": ["string", "list"]
},
"telescope_name":{
"nullable": false,
"required": true,
"type": ["string"]
},
"destination":{
"nullable": false,
"required": true,
"type": ["string"]
},
"comparison":{
"allowed": ["direct", "scaled"],
"nullable": false,
"required": false,
"type": ["string"]
},
"zarr_container_name":{
"nullable": true,
"required": false,
"type": ["string"]
},
"plot_data":{
"nullable": false,
"required": false,
"type": ["boolean"]
},
"plot_percentuals":{
"nullable": false,
"required": false,
"type": ["boolean"]
},
"plot_divided_image":{
"nullable": false,
"required": false,
"type": ["boolean"]
},
"plot_scatter":{
"nullable": false,
"required": false,
"type": ["boolean"]
},
"export_to_fits":{
"nullable": false,
"required": false,
"type": ["boolean"]
},
"colormap":{
"nullable": false,
"required": false,
"type": ["string"],
"check allowed with": "colormaps"
},
"dpi":{
"nullable": false,
"required": false,
"type": ["int"],
"min": 1,
"max": 1200
},
"display":{
"nullable": false,
"required": false,
"type": ["boolean"]
},
"parallel":{
"nullable": false,
"required": false,
"type": ["boolean"]
}
}
}
Loading