Skip to content

Commit a063d3e

Browse files
committed
Now shunting through the input rv if it's valid but there is no parallax.
1 parent 8820ca0 commit a063d3e

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

expected/epochprop.out

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SET extra_float_digits=2;
1+
SET extra_float_digits = 1;
22
SELECT
33
to_char(DEGREES(tp[1]), '999D9999999999'),
44
to_char(DEGREES(tp[2]), '999D9999999999'),
@@ -45,9 +45,9 @@ FROM (
4545
NULL,
4646
RADIANS(-801.551/3.6e6), RADIANS(10362/3.6e6), -110,
4747
-100) AS tp) AS q;
48-
to_char | to_char | to_char | to_char | to_char | to_char
49-
-----------------+-----------------+---------+----------+------------+---------
50-
269.4744079540 | 4.4055337210 | | -801.210 | 10361.762 |
48+
to_char | to_char | to_char | to_char | to_char | to_char
49+
-----------------+-----------------+---------+----------+------------+----------
50+
269.4744079540 | 4.4055337210 | | -801.210 | 10361.762 | -110.000
5151
(1 row)
5252

5353
SELECT

sql/epochprop.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SET extra_float_digits=2;
1+
SET extra_float_digits = 1;
22

33
SELECT
44
to_char(DEGREES(tp[1]), '999D9999999999'),

src/epochprop.c

+10-1
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,23 @@ epoch_prop(PG_FUNCTION_ARGS) {
184184

185185
propagate_phasevec(&input, delta_t, &output);
186186

187+
/* If we have a null parallax but a good RV, preserve the original,
188+
untransformed RV on output. See
189+
https://github.com/ivoa-std/udf-catalogue/pull/20#issuecomment-2115053757
190+
for the rationale. */
191+
if (!PG_ARGISNULL(4) && PG_ARGISNULL(1)) {
192+
output_null[5] = 0;
193+
output.rv = input.rv;
194+
}
195+
187196
/* change to internal units: rad, rad/yr, mas, and km/s */
188197
retvals[0] = Float8GetDatum(output.pos.lng);
189198
retvals[1] = Float8GetDatum(output.pos.lat);
190199
retvals[2] = Float8GetDatum(output.parallax);
191200
retvals[3] = Float8GetDatum(output.pm[0]);
192201
retvals[4] = Float8GetDatum(output.pm[1]);
193202
retvals[5] = Float8GetDatum(output.rv);
194-
203+
195204
{
196205
int lower_bounds[1] = {1};
197206
int dims[1] = {6};

0 commit comments

Comments
 (0)