File: xfunct.c

package info (click to toggle)
fitsh 0.9.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 2,768 kB
  • ctags: 4,050
  • sloc: ansic: 53,352; makefile: 1,120; sh: 25
file content (78 lines) | stat: -rw-r--r-- 2,000 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*****************************************************************************/
/* xfunct.c								     */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Some extra functions for extending the default 'lfit' functionality:	     */
/*	- eccentric_offset_{q,p}(l,k,h) -- eop(), eoq(): eccentric offset    */
/*	  functions and their derivatives (these functions are analytic for  */
/*	  k^2 + h^2 < 1 and for all values of l).			     */
/*	- HJD and BJD functions						     */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* (c) 2007; Pal, A. (apal@szofi.elte.hu)				     */
/*****************************************************************************/

#include <stdio.h>
#include <math.h>
#include <stdlib.h>

#include <astro/astro.h>

#include "xfunct.h"

/*****************************************************************************/

double eccentric_offset_q(double lambda,double k,double h)
{
 double	e,E;
 e=sqrt(h*h+k*k);
 if ( e<=0.0 )
	return(0.0); 
 else
  {	E=solve_kepler_equ(lambda-atan2(h,k),e);
	return(e*cos(E));
  }
}
double eccentric_offset_p(double lambda,double k,double h)
{
 double	e,E;
 e=sqrt(h*h+k*k);
 if ( e<=0.0 )
	return(0.0); 
 else
  {	E=solve_kepler_equ(lambda-atan2(h,k),e);
	return(e*sin(E));
  }
 
}

double eccentric_trigonometric_c(double lambda,double k,double h)
{
 return(cos(lambda+eccentric_offset_p(lambda,k,h)));
}

double eccentric_trigonometric_s(double lambda,double k,double h)
{
 return(sin(lambda+eccentric_offset_p(lambda,k,h)));
}

/*****************************************************************************/

double get_hjd(double jd,double ra,double dec)
{
 double	hjd;

 hjd=get_heliocentric_julian_date(jd,ra,dec);

 return(hjd);
}

double get_bjd(double jd,double ra,double dec)
{
 double	bjd;

 bjd=get_barycentric_julian_date(jd,ra,dec);

 return(bjd);
}

/*****************************************************************************/