Skip to content

Commit

Permalink
Now shunting through the input rv if it's valid but there is no paral…
Browse files Browse the repository at this point in the history
…lax.
  • Loading branch information
msdemlei committed May 22, 2024
1 parent 8820ca0 commit a063d3e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
8 changes: 4 additions & 4 deletions expected/epochprop.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SET extra_float_digits=2;
SET extra_float_digits = 1;
SELECT
to_char(DEGREES(tp[1]), '999D9999999999'),
to_char(DEGREES(tp[2]), '999D9999999999'),
Expand Down Expand Up @@ -45,9 +45,9 @@ FROM (
NULL,
RADIANS(-801.551/3.6e6), RADIANS(10362/3.6e6), -110,
-100) AS tp) AS q;
to_char | to_char | to_char | to_char | to_char | to_char
-----------------+-----------------+---------+----------+------------+---------
269.4744079540 | 4.4055337210 | | -801.210 | 10361.762 |
to_char | to_char | to_char | to_char | to_char | to_char
-----------------+-----------------+---------+----------+------------+----------
269.4744079540 | 4.4055337210 | | -801.210 | 10361.762 | -110.000
(1 row)

SELECT
Expand Down
2 changes: 1 addition & 1 deletion sql/epochprop.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SET extra_float_digits=2;
SET extra_float_digits = 1;

SELECT
to_char(DEGREES(tp[1]), '999D9999999999'),
Expand Down
11 changes: 10 additions & 1 deletion src/epochprop.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,23 @@ epoch_prop(PG_FUNCTION_ARGS) {

propagate_phasevec(&input, delta_t, &output);

/* If we have a null parallax but a good RV, preserve the original,
untransformed RV on output. See
https://github.com/ivoa-std/udf-catalogue/pull/20#issuecomment-2115053757
for the rationale. */
if (!PG_ARGISNULL(4) && PG_ARGISNULL(1)) {
output_null[5] = 0;
output.rv = input.rv;
}

/* change to internal units: rad, rad/yr, mas, and km/s */
retvals[0] = Float8GetDatum(output.pos.lng);
retvals[1] = Float8GetDatum(output.pos.lat);
retvals[2] = Float8GetDatum(output.parallax);
retvals[3] = Float8GetDatum(output.pm[0]);
retvals[4] = Float8GetDatum(output.pm[1]);
retvals[5] = Float8GetDatum(output.rv);

{
int lower_bounds[1] = {1};
int dims[1] = {6};
Expand Down

0 comments on commit a063d3e

Please sign in to comment.