@@ -80,7 +80,7 @@ static int is_ok(const char *func, int error) {
80
80
static int is_equal (const char * func , double v1 , double v2 , double prec ) {
81
81
if (fabs (v1 - v2 ) < prec ) return 1 ;
82
82
83
- fprintf (stderr , "ERROR! %s (%.9g != %.9g )\n" , func , v1 , v2 );
83
+ fprintf (stderr , "ERROR! %s (%.12g != %.12g )\n" , func , v1 , v2 );
84
84
return 0 ;
85
85
}
86
86
@@ -93,7 +93,7 @@ static int test_gcrs_j2000_gcrs() {
93
93
94
94
if (!is_ok ("gcrs_to_j2000" , gcrs_to_j2000 (pos0 , pos1 ))) return 1 ;
95
95
if (!is_ok ("j2000_to_gcrs" , j2000_to_gcrs (pos1 , pos1 ))) return 1 ;
96
- if (!is_ok ("gcrs_j2000_gcrs" , check_equal_pos (pos0 , pos1 , 1e-9 * vlen (pos0 )))) return 1 ;
96
+ if (!is_ok ("gcrs_j2000_gcrs" , check_equal_pos (pos0 , pos1 , 1e-12 * vlen (pos0 )))) return 1 ;
97
97
return 0 ;
98
98
}
99
99
@@ -102,7 +102,7 @@ static int test_j2000_tod_j2000() {
102
102
103
103
if (!is_ok ("j2000_to_tod" , j2000_to_tod (tdb , 0 , pos0 , pos1 ))) return 1 ;
104
104
if (!is_ok ("tod_to_j2000" , tod_to_j2000 (tdb , 0 , pos1 , pos1 ))) return 1 ;
105
- if (!is_ok ("j2000_tod_j2000" , check_equal_pos (pos0 , pos1 , 1e-9 * vlen (pos0 )))) return 1 ;
105
+ if (!is_ok ("j2000_tod_j2000" , check_equal_pos (pos0 , pos1 , 1e-12 * vlen (pos0 )))) return 1 ;
106
106
return 0 ;
107
107
}
108
108
@@ -111,7 +111,7 @@ static int test_tod_itrs_tod() {
111
111
112
112
if (!is_ok ("tod_to_itrs" , tod_to_itrs (tdb , 0.0 , ut12tt , 0 , xp , yp , pos0 , pos1 ))) return 1 ;
113
113
if (!is_ok ("itrs_to_tod" , itrs_to_tod (tdb , 0.0 , ut12tt , 0 , xp , yp , pos1 , pos1 ))) return 1 ;
114
- if (!is_ok ("tod_itrs_tod" , check_equal_pos (pos0 , pos1 , 1e-9 * vlen (pos0 )))) return 1 ;
114
+ if (!is_ok ("tod_itrs_tod" , check_equal_pos (pos0 , pos1 , 1e-12 * vlen (pos0 )))) return 1 ;
115
115
return 0 ;
116
116
}
117
117
@@ -120,7 +120,7 @@ static int test_gcrs_cirs_gcrs() {
120
120
121
121
if (!is_ok ("gcrs_to_cirs" , gcrs_to_cirs (tdb , 0 , pos0 , pos1 ))) return 1 ;
122
122
if (!is_ok ("cirs_to_gcrs" , cirs_to_gcrs (tdb , 0 , pos1 , pos1 ))) return 1 ;
123
- if (!is_ok ("gcrs_cirs_gcrs" , check_equal_pos (pos0 , pos1 , 1e-9 * vlen (pos0 )))) return 1 ;
123
+ if (!is_ok ("gcrs_cirs_gcrs" , check_equal_pos (pos0 , pos1 , 1e-12 * vlen (pos0 )))) return 1 ;
124
124
return 0 ;
125
125
}
126
126
@@ -130,7 +130,7 @@ static int test_cirs_itrs_cirs() {
130
130
131
131
if (!is_ok ("cirs_to_itrs" , cirs_to_itrs (tdb , 0.0 , ut12tt , 0 , xp , yp , pos0 , pos1 ))) return 1 ;
132
132
if (!is_ok ("itrs_to_cirs" , itrs_to_cirs (tdb , 0.0 , ut12tt , 0 , xp , yp , pos1 , pos1 ))) return 1 ;
133
- if (!is_ok ("cirs_itrs_cirs" , check_equal_pos (pos0 , pos1 , 1e-9 * vlen (pos0 )))) return 1 ;
133
+ if (!is_ok ("cirs_itrs_cirs" , check_equal_pos (pos0 , pos1 , 1e-12 * vlen (pos0 )))) return 1 ;
134
134
return 0 ;
135
135
}
136
136
@@ -147,7 +147,7 @@ static int test_itrs_hor_itrs() {
147
147
148
148
if (!is_ok ("itrs_to_hor" , itrs_to_hor (& obs .on_surf , p , & az , & za ))) return 1 ;
149
149
if (!is_ok ("hor_to_itrs" , hor_to_itrs (& obs .on_surf , az , za , pos1 ))) return 1 ;
150
- if (!is_ok ("itrs_hor_itrs" , check_equal_pos (p , pos1 , 1e-9 ))) return 1 ;
150
+ if (!is_ok ("itrs_hor_itrs" , check_equal_pos (p , pos1 , 1e-12 ))) return 1 ;
151
151
152
152
if (!is_ok ("itrs_to_hor:az:null" , itrs_to_hor (& obs .on_surf , p , NULL , & za ))) return 1 ;
153
153
if (!is_ok ("itrs_to_hor:za:null" , itrs_to_hor (& obs .on_surf , p , & az , NULL ))) return 1 ;
@@ -165,23 +165,23 @@ static int test_cel2ter2cel() {
165
165
166
166
if (!is_ok ("cel2ter2cel:cel2ter:1" , cel2ter (tdb , 0.0 , 0.0 , EROT_GST , NOVAS_FULL_ACCURACY , NOVAS_REFERENCE_CLASS , 1.0 , 0.0 , p0 , p ))) return 1 ;
167
167
if (!is_ok ("cel2ter2cel:ter2cel:1" , ter2cel (tdb , 0.0 , 0.0 , EROT_GST , NOVAS_FULL_ACCURACY , NOVAS_REFERENCE_CLASS , 1.0 , 0.0 , p , p ))) return 1 ;
168
- if (!is_ok ("itrs_hor_itrs" , check_equal_pos (p , p0 , 1e-9 ))) return 1 ;
168
+ if (!is_ok ("itrs_hor_itrs" , check_equal_pos (p , p0 , 1e-12 ))) return 1 ;
169
169
170
170
if (!is_ok ("cel2ter2cel:cel2ter:2" , cel2ter (tdb , 0.0 , 0.0 , EROT_GST , NOVAS_FULL_ACCURACY , NOVAS_REFERENCE_CLASS , 0.0 , 1.0 , p0 , p ))) return 1 ;
171
171
if (!is_ok ("cel2ter2cel:ter2cel:2" , ter2cel (tdb , 0.0 , 0.0 , EROT_GST , NOVAS_FULL_ACCURACY , NOVAS_REFERENCE_CLASS , 0.0 , 1.0 , p , p ))) return 1 ;
172
- if (!is_ok ("itrs_hor_itrs" , check_equal_pos (p , p0 , 1e-9 ))) return 1 ;
172
+ if (!is_ok ("itrs_hor_itrs" , check_equal_pos (p , p0 , 1e-12 ))) return 1 ;
173
173
174
174
if (!is_ok ("cel2ter2cel:cel2ter:3" , cel2ter (tdb , 0.0 , 0.0 , EROT_GST , NOVAS_FULL_ACCURACY , NOVAS_REFERENCE_CLASS , 0.0 , 0.0 , p0 , p ))) return 1 ;
175
175
if (!is_ok ("cel2ter2cel:ter2cel:3" , ter2cel (tdb , 0.0 , 0.0 , EROT_GST , NOVAS_FULL_ACCURACY , NOVAS_REFERENCE_CLASS , 0.0 , 0.0 , p , p ))) return 1 ;
176
- if (!is_ok ("itrs_hor_itrs" , check_equal_pos (p , p0 , 1e-9 ))) return 1 ;
176
+ if (!is_ok ("itrs_hor_itrs" , check_equal_pos (p , p0 , 1e-12 ))) return 1 ;
177
177
178
178
if (!is_ok ("cel2ter2cel:cel2ter:dyn" , cel2ter (tdb , 0.0 , 0.0 , EROT_GST , NOVAS_FULL_ACCURACY , NOVAS_DYNAMICAL_CLASS , 0.0 , 0.0 , p0 , p ))) return 1 ;
179
179
if (!is_ok ("cel2ter2cel:ter2cel:dyn" , ter2cel (tdb , 0.0 , 0.0 , EROT_GST , NOVAS_FULL_ACCURACY , NOVAS_DYNAMICAL_CLASS , 0.0 , 0.0 , p , p ))) return 1 ;
180
- if (!is_ok ("itrs_hor_itrs" , check_equal_pos (p , p0 , 1e-9 ))) return 1 ;
180
+ if (!is_ok ("itrs_hor_itrs" , check_equal_pos (p , p0 , 1e-12 ))) return 1 ;
181
181
182
182
if (!is_ok ("cel2ter2cel:cel2ter:era" , cel2ter (tdb , 0.0 , 0.0 , EROT_ERA , NOVAS_FULL_ACCURACY , NOVAS_REFERENCE_CLASS , 0.0 , 0.0 , p0 , p ))) return 1 ;
183
183
if (!is_ok ("cel2ter2cel:ter2cel:era" , ter2cel (tdb , 0.0 , 0.0 , EROT_ERA , NOVAS_FULL_ACCURACY , NOVAS_REFERENCE_CLASS , 0.0 , 0.0 , p , p ))) return 1 ;
184
- if (!is_ok ("itrs_hor_itrs" , check_equal_pos (p , p0 , 1e-9 ))) return 1 ;
184
+ if (!is_ok ("itrs_hor_itrs" , check_equal_pos (p , p0 , 1e-12 ))) return 1 ;
185
185
186
186
return 0 ;
187
187
}
@@ -452,16 +452,16 @@ static int test_app_hor(enum novas_reference_system sys) {
452
452
if (!is_ok ("app_hor:app_to_hor" , novas_app_to_hor (& frame , sys , ra , dec , NULL , & az , & el ))) return 1 ;
453
453
if (!is_ok ("app_hor:hor_to_app" , novas_hor_to_app (& frame , az , el , NULL , sys , & ra1 , & dec1 ))) return 1 ;
454
454
455
- if (!is_equal ("app_hor:hor_to_app :ra" , ra1 , ra , 1e-8 )) return 1 ;
456
- if (!is_equal ("app_hor:hor_to_app :dec" , dec1 , dec , 1e-9 )) return 1 ;
455
+ if (!is_equal ("app_hor:trip :ra" , ra1 , ra , 1e-7 )) return 1 ;
456
+ if (!is_equal ("app_hor:trip :dec" , dec1 , dec , 1e-6 )) return 1 ;
457
457
458
458
if (!is_ok ("app_hor:app_to_hor:refract" , novas_app_to_hor (& frame , sys , ra , dec , novas_standard_refraction , & az , & el ))) return 1 ;
459
459
if (!is_ok ("app_hor:hor_to_app:refract" , novas_hor_to_app (& frame , az , el , novas_standard_refraction , sys , & ra1 , & dec1 ))) return 1 ;
460
460
461
461
// TODO check against cel2ter...
462
462
463
- if (!is_equal ("app_hor:hor_to_app: refract:ra" , ra1 , ra , 1e-8 )) return 1 ;
464
- if (!is_equal ("app_hor:hor_to_app: refract:dec" , dec1 , dec , 1e-9 )) return 1 ;
463
+ if (!is_equal ("app_hor:refract:trip: ra" , ra1 , ra , 1e-7 )) return 1 ;
464
+ if (!is_equal ("app_hor:refract:trip: dec" , dec1 , dec , 1e-6 )) return 1 ;
465
465
466
466
467
467
return 0 ;
@@ -496,7 +496,9 @@ static int test_source() {
496
496
497
497
if (test_geo_posvel ()) n ++ ;
498
498
499
- //for(k = 0; k < NOVAS_REFERENCE_SYSTEMS; k++) if(test_app_hor(k)) n++;
499
+ if (test_app_hor (1 )) n ++ ;
500
+
501
+ for (k = 0 ; k < NOVAS_REFERENCE_SYSTEMS ; k ++ ) if (test_app_hor (k )) n ++ ;
500
502
501
503
return n ;
502
504
}
@@ -849,16 +851,16 @@ static int test_sky_pos(enum novas_reference_system sys) {
849
851
if (!is_ok (label , novas_sky_pos (& source [i ], & frame , sys , & p ))) return 1 ;
850
852
851
853
sprintf (label , "sky_pos:sys=%d:source=%d:check:ra" , sys , i );
852
- if (!is_equal (label , p .ra , pc .ra , 1e-9 )) return 1 ;
854
+ if (!is_equal (label , p .ra , pc .ra , 1e-10 )) return 1 ;
853
855
854
856
sprintf (label , "sky_pos:sys=%d:source=%d:check:dec" , sys , i );
855
- if (!is_equal (label , p .dec , pc .dec , 1e-10 )) return 1 ;
857
+ if (!is_equal (label , p .dec , pc .dec , 1e-9 )) return 1 ;
856
858
857
859
sprintf (label , "sky_pos:sys=%d:source=%d:check:rv" , sys , i );
858
- if (!is_equal (label , p .rv , pc .rv , 1e-12 )) return 1 ;
860
+ if (!is_equal (label , p .rv , pc .rv , 1e-9 )) return 1 ;
859
861
860
862
sprintf (label , "sky_pos:sys=%d:source=%d:check:r_hat" , sys , i );
861
- if (!is_ok (label , check_equal_pos (p .r_hat , pc .r_hat , 1e-9 ))) return 1 ;
863
+ if (!is_ok (label , check_equal_pos (p .r_hat , pc .r_hat , 1e-12 ))) return 1 ;
862
864
}
863
865
864
866
return 0 ;
0 commit comments