Skip to content
Snippets Groups Projects
Commit e303bf47 authored by Maaijke Mevius's avatar Maaijke Mevius
Browse files

disable plint duplicate-code for tests

parent eebf6c17
No related branches found
No related tags found
2 merge requests!12Rmcalc,!8Draft: Magnetic
Pipeline #101518 passed
# pylint: disable=duplicate-code
from __future__ import annotations
import astropy.units as u
import numpy as np
from astropy.coordinates import EarthLocation, SkyCoord
from astropy.time import Time
from spinifex.geometry import get_ipp
from spinifex.geometry.get_ipp import IPP, get_ipp_from_skycoord
def test_geometry():
"""Test the geometry module"""
def get_test_ipp() -> IPP:
source = SkyCoord.from_name("Cas A")
lon = 6.367 * u.deg
lat = 52.833 * u.deg
heights = np.arange(100, 2000, 100) * u.km
dwingeloo = EarthLocation(lon=lon, lat=lat, height=0 * u.km)
times = Time("2020-03-21T01:00:00") + np.arange(0, 10) * 15 * u.min
ipp = get_ipp.get_ipp_from_skycoord(
times = Time("2020-01-20T01:00:00") + np.arange(0, 10) * 15 * u.min
return get_ipp_from_skycoord(
loc=dwingeloo, times=times, source=source, height_array=heights
)
assert isinstance(ipp, get_ipp.IPP)
def test_geometry():
"""Test the geometry module"""
ipp = get_test_ipp()
assert isinstance(ipp, IPP)
assert isinstance(ipp.airmass, np.ndarray)
# Copyright (C) 2023 ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0
# pylint: disable=duplicate-code
"""Testing of ionospheric"""
from __future__ import annotations
......
# Copyright (C) 2023 ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0
# pylint: disable=duplicate-code
"""Testing of magnetic"""
from __future__ import annotations
......@@ -9,7 +9,7 @@ import astropy.units as u
import numpy as np
from astropy.coordinates import EarthLocation, SkyCoord
from astropy.time import Time
from spinifex.geometry import get_ipp
from spinifex.geometry.get_ipp import get_ipp_from_skycoord
from spinifex.magnetic import magnetic_models
......@@ -29,8 +29,8 @@ def test_get_magnetic_field():
lat = 52.833 * u.deg
heights = np.arange(100, 2000, 100) * u.km
dwingeloo = EarthLocation(lon=lon, lat=lat, height=0 * u.km)
times = Time("2020-03-21T01:00:00") + np.arange(0, 10) * 15 * u.min
ipp = get_ipp.get_ipp_from_skycoord(
times = Time("2020-01-20T01:00:00") + np.arange(0, 10) * 15 * u.min
ipp = get_ipp_from_skycoord(
loc=dwingeloo, times=times, source=source, height_array=heights
)
field = magnetic_models.ppigrf(ipp)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment