Skip to content

Commit 420469a

Browse files
anawasLukas113
andauthored
Major update of Telescope class (#631)
improve compatibility between OSKAR and RASCIL for Karabo telescope functions. --------- Co-authored-by: lukas.gehrig <lukas.gehrig@fhnw.ch>
1 parent ae7b59f commit 420469a

8 files changed

Lines changed: 353 additions & 105 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,6 @@ karabo/examples/karabo/test/data/results/*
114114
# Other (playground, experiment, ..)
115115
.experiment/*
116116
data_download/*
117+
118+
# files that are generated by OSKAR
119+
karabo/data/meerkat.tm/element_pattern*

karabo/simulation/coordinate_helper.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ def east_north_to_long_lat(
1919
"""
2020

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

@@ -31,7 +31,7 @@ def wgs84_to_cartesian(
3131
lon: Union[float, NDArray[np.float64]],
3232
lat: Union[float, NDArray[np.float64]],
3333
alt: Union[float, NDArray[np.float64]],
34-
radius: int = 6371000,
34+
radius: int = 6378100,
3535
) -> NDArray[np.float64]:
3636
"""Transforms WGS84 to cartesian in meters.
3737

karabo/simulation/sky_model.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -819,14 +819,14 @@ def read_from_file(cls: Type[_TSkyModel], path: str) -> _TSkyModel:
819819

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

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

832832
return cls(dataframe)

0 commit comments

Comments
 (0)