summaryrefslogtreecommitdiff
path: root/tests/unit/map65/test_map65_astro.f90
diff options
context:
space:
mode:
authorhibby <d@vehibberd.com>2026-10-06 21:24:40 +0100
committerhibby <d@vehibberd.com>2026-10-06 21:24:40 +0100
commitc25cbdf6fb6d946175f4335fab77bfea601b56db (patch)
tree6f7a94b7b81f999e434f61b73d47e337dfd26bf2 /tests/unit/map65/test_map65_astro.f90
parent71f5689252c9f13e70e1c24856904475b2307809 (diff)
parent0685fcada9f95fe90f70b387cd7d757da8209624 (diff)
Merge tag 'debian/3.2.0_rc1+dfsg-2' into debian/trixie-backportsdebian/trixie-backports
tagging wsjtx 3.2.0~rc1+dfsg-2
Diffstat (limited to 'tests/unit/map65/test_map65_astro.f90')
-rw-r--r--tests/unit/map65/test_map65_astro.f9062
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/unit/map65/test_map65_astro.f90 b/tests/unit/map65/test_map65_astro.f90
new file mode 100644
index 00000000..275106d7
--- /dev/null
+++ b/tests/unit/map65/test_map65_astro.f90
@@ -0,0 +1,62 @@
+program test_map65_astro
+ use iso_fortran_env, only: real64
+ use astro_mod, only: astro, nt144
+ implicit none
+
+ integer :: ntsky_144, ntsky_1296
+ real :: db_moon_144, degradation_144
+ real :: db_moon_1296, degradation_1296
+ real(real64) :: expected_tsky, expected_degradation
+
+ call run_astro(144, ntsky_144, db_moon_144, degradation_144)
+ call require(any(int(nt144) == ntsky_144), &
+ '144 MHz sky temperature comes from the lookup table')
+
+ call run_astro(1296, ntsky_1296, db_moon_1296, degradation_1296)
+ expected_tsky = (real(ntsky_144, real64) - 2.7_real64) * &
+ (144.0_real64 / 1296.0_real64)**2.6_real64 + 2.7_real64
+ call require(ntsky_1296 == nint(expected_tsky), &
+ 'sky temperature scales from 144 MHz to the selected band')
+
+ expected_degradation = -10.0_real64 * log10( &
+ (real(ntsky_144, real64) + 80.0_real64) / &
+ (13.0_real64 * (408.0_real64 / 144.0_real64)**2.6_real64 + 80.0_real64)) + &
+ real(db_moon_144, real64)
+ call require(abs(real(degradation_144, real64) - expected_degradation) < 1.0e-4_real64, &
+ 'degradation uses the cold-sky temperature for the selected band')
+
+ print '(a)', 'MAP65 Astro tests passed.'
+
+contains
+
+ subroutine run_astro(frequency_mhz, ntsky, db_moon, degradation)
+ integer, intent(in) :: frequency_mhz
+ integer, intent(out) :: ntsky
+ real, intent(out) :: db_moon, degradation
+ real :: az_sun, el_sun, az_moon, el_moon
+ real :: doppler00, doppler, ra_moon, dec_moon, hour_angle
+ real :: semidiameter, polarization_offset, nonreciprocal_loss
+ real :: day, longitude, latitude, local_sidereal_time
+
+ call astro(2025, 1, 15, 12.0, frequency_mhz, 'FN20rx', 2, 0.0, &
+ az_sun, el_sun, az_moon, el_moon, ntsky, doppler00, doppler, &
+ db_moon, ra_moon, dec_moon, hour_angle, degradation, semidiameter, &
+ polarization_offset, nonreciprocal_loss, day, longitude, latitude, &
+ local_sidereal_time)
+ call astro(2025, 1, 15, 12.0, frequency_mhz, 'FN20rx', 1, 0.0, &
+ az_sun, el_sun, az_moon, el_moon, ntsky, doppler00, doppler, &
+ db_moon, ra_moon, dec_moon, hour_angle, degradation, semidiameter, &
+ polarization_offset, nonreciprocal_loss, day, longitude, latitude, &
+ local_sidereal_time)
+ end subroutine run_astro
+
+ subroutine require(condition, description)
+ logical, intent(in) :: condition
+ character(len=*), intent(in) :: description
+
+ if (.not. condition) then
+ print '(a)', 'FAIL: '//description
+ error stop 1
+ end if
+ end subroutine require
+end program test_map65_astro