Skip to content

Commit

Permalink
Major update of Telescope class (#631)
Browse files Browse the repository at this point in the history
improve compatibility between OSKAR and RASCIL for Karabo telescope functions.

---------

Co-authored-by: lukas.gehrig <[email protected]>
  • Loading branch information
anawas and Lukas113 authored Nov 28, 2024
1 parent ae7b59f commit 420469a
Show file tree
Hide file tree
Showing 8 changed files with 353 additions and 105 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,6 @@ karabo/examples/karabo/test/data/results/*
# Other (playground, experiment, ..)
.experiment/*
data_download/*

# files that are generated by OSKAR
karabo/data/meerkat.tm/element_pattern*
10 changes: 5 additions & 5 deletions karabo/simulation/coordinate_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ def east_north_to_long_lat(
"""

# https://stackoverflow.com/questions/7477003/calculating-new-longitude-latitude-from-old-n-meters
r_earth = 6371000
new_latitude = lat + (east_relative / r_earth) * (180 / np.pi)
new_longitude = long + (north_relative / r_earth) * (180 / np.pi) / np.cos(
long * np.pi / 180
r_earth = 6378100 # from astropy (astropy.constants.R_earth.value)
new_latitude = lat + np.rad2deg(east_relative / r_earth)
new_longitude = long + np.rad2deg(north_relative / r_earth) / np.cos(
np.deg2rad(long)
)
return new_longitude, new_latitude

Expand All @@ -31,7 +31,7 @@ def wgs84_to_cartesian(
lon: Union[float, NDArray[np.float64]],
lat: Union[float, NDArray[np.float64]],
alt: Union[float, NDArray[np.float64]],
radius: int = 6371000,
radius: int = 6378100,
) -> NDArray[np.float64]:
"""Transforms WGS84 to cartesian in meters.
Expand Down
6 changes: 3 additions & 3 deletions karabo/simulation/sky_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,14 +819,14 @@ def read_from_file(cls: Type[_TSkyModel], path: str) -> _TSkyModel:

if dataframe.shape[1] < 3:
raise KaraboSkyModelError(
f"CSV does not have the necessary 3 basic columns (RA, DEC and "
"CSV does not have the necessary 3 basic columns (RA, DEC and "
f"STOKES I), but only {dataframe.shape[1]} columns."
)

if dataframe.shape[1] > cls.SOURCES_COLS:
print(
f"""CSV has {dataframe.shape[1] - cls.SOURCES_COLS + 1}
too many rows. The extra rows will be cut off."""
f"CSV has {dataframe.shape[1] - cls.SOURCES_COLS + 1} "
"rows too many. The extra rows will be cut off."
)

return cls(dataframe)
Expand Down
Loading

0 comments on commit 420469a

Please sign in to comment.