antenna_main.cpp 2.28 KB
Newer Older
1
2
3
4
// Copyright Bruce Allen 2017
// Compile with gcc -o antenna antenna.c -lm

// REMAINING THINGS TO CHECK:
5
6
7
8
9
10
11
12
13
14
15
16
17
18

// (a) sign conventions for h, which arm is positive CONFIRMED.  VIRGO
//  AND LIGO DEFINE THE POSITIVE ARM AS "X" where X defined by right
//  hand rule with two arms and Z away from center of earth.

// (b) direction and origin conventions for the polarization axis The
// convention for LAL is that psi is the angle that the source plane
// is rotated CCW as viewed from the Earth.  The convention in my
// calculation is the opposite.  So in my code I have changed the sign
// inside get_antenna() so that the arguments now correspond to LAL
// ones.  Thus in this code, the conventions correspond to LAL.

// IOTA is zero when orbital angular momentum points to earth
// PSI is orbital plane rotation CCW as viewed from Earth
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include "antenna_lib.h"

// This function requires two floating point arguments on the command
// line, iota and psi, angles in degrees.
int main(int argc, char *argv[]) {
   // to loop over detectors
   int i;

   // to pass data in and out
   struct InputStruct myinput;
   struct OutputStruct myoutput;
35

36
37
38
39
40
41
42
43
44
45
   // check syntax crudely, issue usage message
   if (argc != 3) {
      fprintf(stderr,
	      "Wrong argument count! Correct usage:\n"
	      "%s float_iota_in_degrees float_psi_in_degrees\n",
	      argv[0]);
      exit(1);
   }
   myinput.iota = atof(argv[1]);
   myinput.psi = atof(argv[2]);
46
47

   // pass inclination angle, polarization axis, orientation offsets
48
49
50
51
52
53
54
   for (i=0;i<3;i++) myinput.orientation[i]=0.0;
   
   printf("Iota = %f degrees\nPsi = %f degrees\n", myinput.iota, myinput.psi);

   // now compute responses
   get_antenna(&myoutput, &myinput);

55
56
57
   for (i=0; i<3; i++) print_detector(i);
   print_source();

58
59
60
61
62
   // degree character in UTF-8 character set (most likely terminal type!)
   int deg1=0xC2, deg2=0xB0;
   
   // Now display waveforms
   for (i=0; i<3; i++)
63
64
      printf("For detector %s the waveform is %.3f w^2 sin(2w[t%+.1f ms]%+.1f%c%c)\n",
	     myoutput.name[i], myoutput.amp[i], myoutput.dt[i], myoutput.phase[i], deg1, deg2);
65

66
67
   // prints angles between line in between detector i arms and direction to source
   // for (i=0; i<3; i++) print_angles(i);
68

69
70
   return 0;
}