Commit 13361d9d authored by Bruce Allen's avatar Bruce Allen
Browse files

Adding some helper functions to print angles for antennas, better install notes

parent 137aeb4e
......@@ -4,10 +4,10 @@ git checkout -b antenna-patterns origin/antenna-patterns
Mac instructions
(1) Get the executable from
www.atlas.aei.uni-hannover.de/~ballen/LSC/GW170817.app.tar
www.atlas.aei.uni-hannover.de/~ballen/LSC/GW170817.zip
(2) To install the app:
tar xvf GW170817.app.tar
unzip GW170817.zip
(3) Download and install the Qt framework. Either:
use MacPorts to install the qt4-mac package:
......@@ -17,6 +17,9 @@ Mac instructions
http://download.qt.io/archive/qt/4.8/4.8.6/qt-opensource-mac-4.8.6-1.dmg
(4) open GW170817.app
You may need to (temporarily) modify your security preferences to run
an app that is not from the Apple Store or an Approved Developer.
You can find this in System Preferences -> Security & Privacy -> General
Linux instructions
......
......@@ -153,6 +153,35 @@ void make_unit_vectors(double *out, double *in) {
out[2] = sin(lat);
}
void print_angles() {
// prints angles between line in between detector arms and direction to source
int i;
double line1[3];
double line2[3];
double sqrt2 = sqrt(2.0);
// loop over detectors
for (i=0; i<3; i++) {
int j;
// loop over coordinates
for (j=0; j<3; j++) {
line1[j]=(detectors[i].lx[j]+detectors[i].ly[j])/sqrt2;
line2[j]=(detectors[i].lx[j]-detectors[i].ly[j])/sqrt2;
}
float cosang1 = 0.0;
float cosang2 = 0.0;
for (j=0; j<3; j++) {
cosang1 += line1[j]*source.vec[j];
cosang2 += line2[j]*source.vec[j];
}
printf("%s: Cos ang1 = %f, ang1 = %f deg\n", detectors[i].name, cosang1, acos(cosang1)/deg_to_rad);
printf("%s: Cos ang2 = %f, ang2 = %f deg\n", detectors[i].name, cosang2, acos(cosang2)/deg_to_rad);
}
return;
}
void make_u_v_vectors(struct Source *src) {
// lattitude and longitude
double lat = src->location[0];
......@@ -418,5 +447,6 @@ int main(int argc, char *argv[]) {
for (i=0; i<3; i++)
printf("For detector %s the waveform is %.3f w^2 sin(2w[t%+.1f ms]%+.1f%c%c)\n", detectors[i].name, myoutput.amp[i], myoutput.dt[i], myoutput.phase[i], deg1, deg2);
print_angles();
return 0;
}
......@@ -360,7 +360,8 @@ void get_antenna(struct OutputStruct *out, struct InputStruct *in) {
out->amp[i]= amp;
out->phase[i] = ang-2*psi*ci/deg_to_rad;
out->dt[i] = dt;
#define DEBUG
#ifdef DEBUG
// degree character in UTF-8 character set (most likely terminal type!)
int deg1=0xC2, deg2=0xB0;
......@@ -375,3 +376,30 @@ void get_antenna(struct OutputStruct *out, struct InputStruct *in) {
return;
}
void print_angles(int i) {
// prints angles between line in between detector i arms and direction to source
double line1[3];
double line2[3];
double sqrt2 = sqrt(2.0);
int j;
// loop over coordinates
for (j=0; j<3; j++) {
line1[j]=(detectors[i].lx[j]+detectors[i].ly[j])/sqrt2;
line2[j]=(detectors[i].lx[j]-detectors[i].ly[j])/sqrt2;
}
float cosang1 = 0.0;
float cosang2 = 0.0;
for (j=0; j<3; j++) {
cosang1 += line1[j]*source.vec[j];
cosang2 += line2[j]*source.vec[j];
}
printf("%s: Cos ang1 = %f, ang1 = %f deg\n", detectors[i].name, cosang1, acos(cosang1)/deg_to_rad);
printf("%s: Cos ang2 = %f, ang2 = %f deg\n", detectors[i].name, cosang2, acos(cosang2)/deg_to_rad);
return;
}
......@@ -33,4 +33,6 @@ struct OutputStruct {
// input structure (not modified) and writing to the output structure.
void get_antenna(struct OutputStruct *out, struct InputStruct *in);
void print_angles(int i);
#endif // ANTENNA_LIB_H
......@@ -48,5 +48,7 @@ int main(int argc, char *argv[]) {
for (i=0; i<3; 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);
for (i=0; i<3; i++) print_angles(i);
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment