Select Git revision
test_2d_plot.py
antenna_main.cpp 3.00 KiB
// Copyright Bruce Allen 2017
// Compile with gcc -o antenna antenna.c -lm
// REMAINING THINGS TO CHECK:
// (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
#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;
// Test RA/DEC conversion with GW170817
// Event time
// GPS 1187008882
// UTC: Thu 2017 Aug 17 12:41:04
// Julian Day 2457983.02852
// Modified Julian Day 57982.52852
// Unix Epoch 1502973664
// Right ascension: 13h 09m 47.2s
// Declination: −23° 23′ 4″
// We will need to convert this to location over the Earth at the
// event time. It will turn out to be:
// Lattitude −23.3844 degrees (south of equator)
// Longitude 41.092981 degrees (east of Greenwich)
double lat,lon;
epoch_RA_DEC_to_Latt_Long(1502973664, 13+9.0/60.0+47.2/3600.0, -(23+23.0/60.0+4.0/3600.0), &lat,&lon);
printf("GW170817 Lattitude = %f Longitude = %f\n", lat, lon);
exit(0);
// to pass data in and out
struct InputStruct myinput;
struct OutputStruct myoutput;
// 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]);
// pass inclination angle, polarization axis, orientation offsets
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);
for (i=0; i<5; i++) print_detector(i);
print_source();
print_patterns();
// degree character in UTF-8 character set (most likely terminal type!)
int deg1=0xC2, deg2=0xB0;
// Now display waveforms
for (i=0; i<5; i++)
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);
// prints angles between line in between detector i arms and direction to source
// for (i=0; i<5; i++) print_angles(i);
return 0;
}