1
0
Fork 0

Major update to WCSLIB-5 and general clean up

pull/13/merge
Cees Bassa 2018-02-27 22:36:04 +01:00
parent 0175c9c2b3
commit c02d9d26e2
29 changed files with 166 additions and 959 deletions

View File

@ -2,8 +2,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include "cel.h" #include <wcslib/cel.h>
#include "cpgplot.h" #include <cpgplot.h>
#include "qfits.h" #include "qfits.h"
#include <gsl/gsl_multifit.h> #include <gsl/gsl_multifit.h>
#include <getopt.h> #include <getopt.h>
@ -423,41 +423,6 @@ struct image read_fits(char *filename)
return img; return img;
} }
// Get a x and y from a RA and Decl
void forward(double ra0,double de0,double ra,double de,double *x,double *y)
{
int i;
char pcode[4]="TAN";
double phi,theta;
struct celprm cel;
struct prjprm prj;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
if (celset(pcode,&cel,&prj)) {
printf("Error in Projection (celset)\n");
return;
} else {
if (celfwd(pcode,ra,de,&cel,&phi,&theta,&prj,x,y)) {
printf("Error in Projection (celfwd)\n");
return;
}
}
*x*=3600.;
*y*=3600.;
return;
}
// Greenwich Mean Sidereal Time // Greenwich Mean Sidereal Time
double gmst(double mjd) double gmst(double mjd)
@ -683,42 +648,6 @@ void lfit2d(float *x,float *y,float *z,int n,float *a)
return; return;
} }
// Get a RA and Decl from x and y
void reverse(double ra0,double de0,double x,double y,double *ra,double *de)
{
int i;
char pcode[4]="TAN";
double phi,theta;
struct celprm cel;
struct prjprm prj;
x/=3600.;
y/=3600.;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
if (celset(pcode,&cel,&prj)) {
printf("Error in Projection (celset)\n");
return;
} else {
if (celrev(pcode,x,y,&prj,&phi,&theta,&cel,ra,de)) {
printf("Error in Projection (celrev)\n");
return;
}
}
return;
}
// Add FITS keywords // Add FITS keywords
void add_fits_keywords(struct transformation t,char *filename) void add_fits_keywords(struct transformation t,char *filename)
{ {

View File

@ -2,7 +2,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include "cel.h" #include <wcslib/cel.h>
#define LIM 80 #define LIM 80
@ -162,75 +162,3 @@ double sex2dec(char *s)
return x; return x;
} }
// Get a RA and Decl from x and y
void reverse(double ra0,double de0,double x,double y,double *ra,double *de)
{
int i;
char pcode[4]="TAN";
double phi,theta;
struct celprm cel;
struct prjprm prj;
x/=3600.;
y/=3600.;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
if (celset(pcode,&cel,&prj)) {
printf("Error in Projection (celset)\n");
return;
} else {
if (celrev(pcode,x,y,&prj,&phi,&theta,&cel,ra,de)) {
printf("Error in Projection (celrev)\n");
return;
}
}
return;
}
// Get a x and y from a RA and Decl
void forward(double ra0,double de0,double ra,double de,double *x,double *y)
{
int i;
char pcode[4]="TAN";
double phi,theta;
struct celprm cel;
struct prjprm prj;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
if (celset(pcode,&cel,&prj)) {
printf("Error in Projection (celset)\n");
return;
} else {
if (celfwd(pcode,ra,de,&cel,&phi,&theta,&prj,x,y)) {
printf("Error in Projection (celfwd)\n");
return;
}
}
*x *=3600.;
*y *=3600.;
return;
}

View File

@ -3,8 +3,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include "qfits.h" #include "qfits.h"
#include "cpgplot.h" #include <cpgplot.h>
#include "cel.h" #include <wcslib/cel.h>
#include <gsl/gsl_multifit.h> #include <gsl/gsl_multifit.h>
#include <getopt.h> #include <getopt.h>
@ -493,41 +493,6 @@ struct catalog read_astrometric_catalog(char *filename,float mmin,float sx,float
return c; return c;
} }
// Get a x and y from a RA and Decl
void forward(double ra0,double de0,double ra,double de,double *x,double *y)
{
int i;
char pcode[4]="STG";
double phi,theta;
struct celprm cel;
struct prjprm prj;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
if (celset(pcode,&cel,&prj)) {
printf("Error in Projection (celset)\n");
return;
} else {
if (celfwd(pcode,ra,de,&cel,&phi,&theta,&prj,x,y)) {
printf("Error in Projection (celfwd)\n");
return;
}
}
*x *=3600.;
*y *=3600.;
return;
}
// Select nearest object // Select nearest object
int select_nearest(struct catalog c,float x,float y) int select_nearest(struct catalog c,float x,float y)

View File

@ -3,8 +3,8 @@
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include "qfits.h" #include "qfits.h"
#include "cel.h" #include <wcslib/cel.h>
#include "cpgplot.h" #include <cpgplot.h>
#include <getopt.h> #include <getopt.h>
#include <gsl/gsl_rng.h> #include <gsl/gsl_rng.h>
@ -43,7 +43,8 @@ struct point
int flag; int flag;
}; };
struct fourframe read_fits(char *filename); struct fourframe read_fits(char *filename);
void forward(double ra0,double de0,double ra,double de,double *x,double *y);
void reverse(double ra0,double de0,double x,double y,double *ra,double *de);
// Linear least squares fit // Linear least squares fit
float linear_fit(float x[],float y[],float w[],int n,float a[],float sa[]) float linear_fit(float x[],float y[],float w[],int n,float a[],float sa[])
@ -84,78 +85,6 @@ float linear_fit(float x[],float y[],float w[],int n,float a[],float sa[])
return chi2; return chi2;
} }
// Get a x and y from a RA and Decl
void forward(double ra0,double de0,double ra,double de,double *x,double *y)
{
int i;
char pcode[4]="TAN";
double phi,theta;
struct celprm cel;
struct prjprm prj;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
if (celset(pcode,&cel,&prj)) {
printf("Error in Projection (celset)\n");
return;
} else {
if (celfwd(pcode,ra,de,&cel,&phi,&theta,&prj,x,y)) {
printf("Error in Projection (celfwd)\n");
return;
}
}
*x*=3600.;
*y*=3600.;
return;
}
// Get a RA and Decl from x and y
void reverse(double ra0,double de0,double x,double y,double *ra,double *de)
{
int i;
char pcode[4]="TAN";
double phi,theta;
struct celprm cel;
struct prjprm prj;
x/=3600.;
y/=3600.;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
if (celset(pcode,&cel,&prj)) {
printf("Error in Projection (celset)\n");
return;
} else {
if (celrev(pcode,x,y,&prj,&phi,&theta,&cel,ra,de)) {
printf("Error in Projection (celrev)\n");
return;
}
}
return;
}
// Compute Julian Day from Date // Compute Julian Day from Date
double date2mjd(int year,int month,double day) double date2mjd(int year,int month,double day)
{ {

View File

@ -2,6 +2,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <ctype.h>
#include "sgdp4h.h" #include "sgdp4h.h"
#include "satutl.h" #include "satutl.h"
#include <getopt.h> #include <getopt.h>

View File

@ -3,8 +3,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include "qfits.h" #include "qfits.h"
#include "cpgplot.h" #include <cpgplot.h>
#include "cel.h" #include <wcslib/cel.h>
#include <jpeglib.h> #include <jpeglib.h>
#include <getopt.h> #include <getopt.h>
@ -323,75 +323,3 @@ void write_jpg(char *filename,struct jpeg_image img)
return; return;
} }
// Get a x and y from a RA and Decl
void forward(double ra0,double de0,double ra,double de,double *x,double *y)
{
int i;
char pcode[4]="TAN";
double phi,theta;
struct celprm cel;
struct prjprm prj;
double rx,ry;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
if (celset(pcode,&cel,&prj)) {
printf("Error in Projection (celset)\n");
return;
} else {
if (celfwd(pcode,ra,de,&cel,&phi,&theta,&prj,&rx,&ry)) {
printf("Error in Projection (celfwd)\n");
return;
}
}
*x=rx*3600.;
*y=ry*3600.;
return;
}
// Get a RA and Decl from x and y
void reverse(double ra0,double de0,double x,double y,double *ra,double *de)
{
int i;
char pcode[4]="TAN";
double phi,theta;
struct celprm cel;
struct prjprm prj;
x/=3600.;
y/=3600.;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
if (celset(pcode,&cel,&prj)) {
printf("Error in Projection (celset)\n");
return;
} else {
if (celrev(pcode,x,y,&prj,&phi,&theta,&cel,ra,de)) {
printf("Error in Projection (celrev)\n");
return;
}
}
return;
}

View File

@ -3,8 +3,8 @@
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include "qfits.h" #include "qfits.h"
#include "cel.h" #include <wcslib/cel.h>
#include "cpgplot.h" #include <cpgplot.h>
#include <getopt.h> #include <getopt.h>
#include <gsl/gsl_rng.h> #include <gsl/gsl_rng.h>
@ -43,6 +43,8 @@ struct point
int flag; int flag;
}; };
struct fourframe read_fits(char *filename); struct fourframe read_fits(char *filename);
void forward(double ra0,double de0,double ra,double de,double *x,double *y);
void reverse(double ra0,double de0,double x,double y,double *ra,double *de);
// Linear least squares fit // Linear least squares fit
@ -84,78 +86,6 @@ float linear_fit(float x[],float y[],float w[],int n,float a[],float sa[])
return chi2; return chi2;
} }
// Get a x and y from a RA and Decl
void forward(double ra0,double de0,double ra,double de,double *x,double *y)
{
int i;
char pcode[4]="TAN";
double phi,theta;
struct celprm cel;
struct prjprm prj;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
if (celset(pcode,&cel,&prj)) {
printf("Error in Projection (celset)\n");
return;
} else {
if (celfwd(pcode,ra,de,&cel,&phi,&theta,&prj,x,y)) {
printf("Error in Projection (celfwd)\n");
return;
}
}
*x*=3600.;
*y*=3600.;
return;
}
// Get a RA and Decl from x and y
void reverse(double ra0,double de0,double x,double y,double *ra,double *de)
{
int i;
char pcode[4]="TAN";
double phi,theta;
struct celprm cel;
struct prjprm prj;
x/=3600.;
y/=3600.;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
if (celset(pcode,&cel,&prj)) {
printf("Error in Projection (celset)\n");
return;
} else {
if (celrev(pcode,x,y,&prj,&phi,&theta,&cel,ra,de)) {
printf("Error in Projection (celrev)\n");
return;
}
}
return;
}
// Compute Julian Day from Date // Compute Julian Day from Date
double date2mjd(int year,int month,double day) double date2mjd(int year,int month,double day)
{ {

View File

@ -2,7 +2,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include "cel.h" #include <ctype.h>
#include "sgdp4h.h" #include "sgdp4h.h"
#include <getopt.h> #include <getopt.h>
@ -174,7 +174,7 @@ int main(int argc,char *argv[])
// Check for match // Check for match
if (orb.satno!=satno) { if (orb.satno!=satno) {
// fprintf(stderr,"object %d not found in %s\n",p.satno,filename); // fprintf(stderr,"object %d not found in %s\n",p.satno,filename);
return; return 0;
} }
// Initialize // Initialize
@ -237,7 +237,7 @@ struct site get_site(int site_id)
file=fopen(filename,"r"); file=fopen(filename,"r");
if (file==NULL) { if (file==NULL) {
printf("File with site information not found!\n"); printf("File with site information not found!\n");
return; return s;
} }
while (fgets(line,LIM,file)!=NULL) { while (fgets(line,LIM,file)!=NULL) {
// Skip // Skip

View File

@ -1,6 +1,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h>
#define LIM 81 #define LIM 81

32
forward.c 100644
View File

@ -0,0 +1,32 @@
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <wcslib/cel.h>
// Get a x and y from a RA and Decl
void forward(double ra0,double de0,double ra,double de,double *x,double *y)
{
int i,status;
double phi,theta;
struct celprm cel;
// Initialize Reference Angles
celini(&cel);
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
strcpy(cel.prj.code,"TAN");
if (celset(&cel)) {
printf("Error in Projection (celset)\n");
return;
}
cels2x(&cel,1,0,1,1,&ra,&de,&phi,&theta,x,y,&status);
*x *=3600.;
*y *=3600.;
return;
}

View File

@ -4,7 +4,7 @@
CFLAGS = #-O3 -Wno-unused-result CFLAGS = #-O3 -Wno-unused-result
# Linking flags # Linking flags
LFLAGS = -lm -lcpgplot -lpgplot -lX11 -fno-backslash -lpng -L/usr/local/lib -lqfits -lwcs_c -lgsl -lgslcblas -ljpeg -lexif LFLAGS = -lm -lcpgplot -lpgplot -lX11 -lwcs -lgsl -lgslcblas -lpng
# Compilers # Compilers
CC = gcc CC = gcc
@ -61,11 +61,11 @@ posmatch: posmatch.o sgdp4.o satutl.o deep.o ferror.o
propagate: propagate.o sgdp4.o satutl.o deep.o ferror.o propagate: propagate.o sgdp4.o satutl.o deep.o ferror.o
$(CC) -o propagate propagate.o sgdp4.o satutl.o deep.o ferror.o -lm $(CC) -o propagate propagate.o sgdp4.o satutl.o deep.o ferror.o -lm
detect: detect.o detect: detect.o forward.o reverse.o
$(F77) -o detect detect.o -lm $(LFLAGS) $(F77) -o detect detect.o forward.o reverse.o -lm $(LFLAGS) -lqfits
confirm: confirm.o confirm: confirm.o forward.o reverse.o
$(F77) -o confirm confirm.o -lm $(LFLAGS) $(F77) -o confirm confirm.o forward.o reverse.o -lm $(LFLAGS) -lqfits
autodetect: autodetect.o autodetect: autodetect.o
$(F77) -o autodetect autodetect.o -lm $(LFLAGS) $(F77) -o autodetect autodetect.o -lm $(LFLAGS)
@ -79,14 +79,14 @@ slewto: slewto.o
waitfor: waitfor.o waitfor: waitfor.o
$(CC) -o waitfor waitfor.o -lm $(CC) -o waitfor waitfor.o -lm
deproject: deproject.o deproject: deproject.o forward.o reverse.o
$(F77) -o deproject deproject.o $(LFLAGS) $(F77) -o deproject deproject.o forward.o reverse.o $(LFLAGS) -ljpeg -lqfits
jpgstack: jpgstack.o jpgstack: jpgstack.o
$(CC) -o jpgstack jpgstack.o -ljpeg $(CC) -o jpgstack jpgstack.o -ljpeg
angular: angular.o angular: angular.o forward.o reverse.o
$(CC) -o angular angular.c -lm -lwcs_c $(CC) -o angular angular.c forward.o reverse.o -lm -lwcs
dec2sex: dec2sex.o dec2sex: dec2sex.o
$(CC) -o dec2sex dec2sex.c -lm $(CC) -o dec2sex dec2sex.c -lm
@ -94,26 +94,26 @@ dec2sex: dec2sex.o
sex2dec: sex2dec.o sex2dec: sex2dec.o
$(CC) -o sex2dec sex2dec.c -lm $(CC) -o sex2dec sex2dec.c -lm
calibrate: calibrate.o sgdp4.o satutl.o deep.o ferror.o calibrate: calibrate.o forward.o
$(F77) -o calibrate calibrate.o sgdp4.o satutl.o deep.o ferror.o $(LFLAGS) $(F77) -o calibrate calibrate.o forward.o $(LFLAGS) -lqfits
measure: measure.o measure: measure.o reverse.o
$(F77) -o measure measure.o $(LFLAGS) $(F77) -o measure measure.o reverse.o $(LFLAGS) -lqfits
jpg2fits: jpg2fits.o jpg2fits: jpg2fits.o
$(CC) -o jpg2fits jpg2fits.o -lm -L/usr/local/lib -lqfits -ljpeg $(CC) -o jpg2fits jpg2fits.o -lm -lqfits -ljpeg
pstrack: pstrack.o sgdp4.o satutl.o deep.o ferror.o pstrack: pstrack.o sgdp4.o satutl.o deep.o ferror.o forward.o reverse.o
$(F77) -o pstrack pstrack.o sgdp4.o satutl.o deep.o ferror.o $(LFLAGS) $(F77) -o pstrack pstrack.o sgdp4.o satutl.o deep.o ferror.o forward.o reverse.o $(LFLAGS) -lqfits
faketle: faketle.o sgdp4.o satutl.o deep.o ferror.o faketle: faketle.o sgdp4.o satutl.o deep.o ferror.o
$(CC) -o faketle faketle.o sgdp4.o satutl.o deep.o ferror.o -lm $(CC) -o faketle faketle.o sgdp4.o satutl.o deep.o ferror.o -lm
imgstat: imgstat.o imgstat: imgstat.o
$(CC) -o imgstat imgstat.o -lm -L/usr/local/lib -lqfits $(CC) -o imgstat imgstat.o -lm -lqfits
satfit: satfit.o sgdp4.o satutl.o deep.o ferror.o versafit.o dsmin.o simplex.o satfit: satfit.o sgdp4.o satutl.o deep.o ferror.o versafit.o dsmin.o simplex.o forward.o
$(F77) -o satfit satfit.o sgdp4.o satutl.o deep.o ferror.o versafit.o dsmin.o simplex.o $(LFLAGS) $(F77) -o satfit satfit.o sgdp4.o satutl.o deep.o ferror.o versafit.o dsmin.o simplex.o forward.o $(LFLAGS)
uk2iod: uk2iod.o uk2iod: uk2iod.o
$(CC) -o uk2iod uk2iod.o -lm $(CC) -o uk2iod uk2iod.o -lm
@ -122,10 +122,10 @@ rde2iod: rde2iod.o
$(CC) -o rde2iod rde2iod.o -lm $(CC) -o rde2iod rde2iod.o -lm
stviewer: stviewer.o stviewer: stviewer.o
$(CC) -o stviewer stviewer.o -lm -L/usr/local/lib -lqfits $(CC) -o stviewer stviewer.o -lm -lqfits
residuals: residuals.o sgdp4.o satutl.o deep.o ferror.o residuals: residuals.o sgdp4.o satutl.o deep.o ferror.o forward.o
$(CC) -o residuals residuals.o sgdp4.o satutl.o deep.o ferror.o -lm -lwcs_c $(CC) -o residuals residuals.o sgdp4.o satutl.o deep.o ferror.o forward.o -lm -lwcs
tleinfo: tleinfo.o sgdp4.o satutl.o deep.o ferror.o tleinfo: tleinfo.o sgdp4.o satutl.o deep.o ferror.o
$(CC) -o tleinfo tleinfo.o sgdp4.o satutl.o deep.o ferror.o -lm $(CC) -o tleinfo tleinfo.o sgdp4.o satutl.o deep.o ferror.o -lm
@ -140,13 +140,13 @@ runsched: runsched.o
$(CC) -o runsched runsched.o -lm $(CC) -o runsched runsched.o -lm
fitskey: fitskey.o fitskey: fitskey.o
$(CC) -o fitskey fitskey.o -L/usr/local/lib -lqfits $(CC) -o fitskey fitskey.o -lqfits
fitsheader: fitsheader.o fitsheader: fitsheader.o
$(CC) -o fitsheader fitsheader.o -L/usr/local/lib -lqfits $(CC) -o fitsheader fitsheader.o -lqfits
satid: satid.o sgdp4.o satutl.o deep.o ferror.o satid: satid.o sgdp4.o satutl.o deep.o ferror.o forward.o reverse.o
$(F77) -o satid satid.o sgdp4.o satutl.o deep.o ferror.o $(LFLAGS) $(F77) -o satid satid.o sgdp4.o satutl.o deep.o ferror.o forward.o reverse.o $(LFLAGS) -lqfits
skymap: skymap.o sgdp4.o satutl.o deep.o ferror.o skymap: skymap.o sgdp4.o satutl.o deep.o ferror.o
$(F77) -o skymap skymap.o sgdp4.o satutl.o deep.o ferror.o $(LFLAGS) $(F77) -o skymap skymap.o sgdp4.o satutl.o deep.o ferror.o $(LFLAGS)
@ -154,20 +154,20 @@ skymap: skymap.o sgdp4.o satutl.o deep.o ferror.o
pass: pass.o sgdp4.o satutl.o deep.o ferror.o pass: pass.o sgdp4.o satutl.o deep.o ferror.o
$(CC) -o pass pass.o sgdp4.o satutl.o deep.o ferror.o -lm $(CC) -o pass pass.o sgdp4.o satutl.o deep.o ferror.o -lm
reduce: reduce.o reduce: reduce.o forward.o reverse.o
$(F77) -o reduce reduce.o $(LFLAGS) $(F77) -o reduce reduce.o forward.o reverse.o $(LFLAGS) -lqfits
addwcs: addwcs.o addwcs: addwcs.o forward.o reverse.o
$(F77) -o addwcs addwcs.o $(LFLAGS) $(F77) -o addwcs addwcs.o forward.o reverse.o $(LFLAGS) -lqfits
wcsfit: wcsfit.o wcsfit: wcsfit.o forward.o reverse.o
$(F77) -o wcsfit wcsfit.o $(LFLAGS) $(F77) -o wcsfit wcsfit.o forward.o reverse.o $(LFLAGS) -lqfits
plotfits: plotfits.o plotfits: plotfits.o forward.o reverse.o
$(F77) -o plotfits plotfits.o $(LFLAGS) $(F77) -o plotfits plotfits.o forward.o reverse.o $(LFLAGS) -lqfits
pgm2fits: pgm2fits.o pgm2fits: pgm2fits.o
$(F77) -o pgm2fits pgm2fits.o $(LFLAGS) $(F77) -o pgm2fits pgm2fits.o $(LFLAGS) -lqfits
clean: clean:
rm -f *.o rm -f *.o

View File

@ -4,8 +4,8 @@
#include <math.h> #include <math.h>
#include <ctype.h> #include <ctype.h>
#include "qfits.h" #include "qfits.h"
#include "cpgplot.h" #include <cpgplot.h>
#include "cel.h" #include <wcslib/cel.h>
#include <gsl/gsl_multifit.h> #include <gsl/gsl_multifit.h>
#define LIM 256 #define LIM 256
@ -54,6 +54,7 @@ struct aperture {
struct image read_fits(char *filename,int pnum); struct image read_fits(char *filename,int pnum);
int fgetline(FILE *file,char *s,int lim); int fgetline(FILE *file,char *s,int lim);
int select_nearest(struct catalog c,float x,float y); int select_nearest(struct catalog c,float x,float y);
void reverse(double ra0,double de0,double x,double y,double *ra,double *de);
void plot_defects(void) void plot_defects(void)
{ {
@ -162,42 +163,6 @@ void plot_objects(char *filename)
return; return;
} }
// Get a RA and Decl from x and y
void reverse(double ra0,double de0,double x,double y,double *ra,double *de)
{
int i;
char pcode[4]="TAN";
double phi,theta;
struct celprm cel;
struct prjprm prj;
x/=3600.;
y/=3600.;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
if (celset(pcode,&cel,&prj)) {
printf("Error in Projection (celset)\n");
return;
} else {
if (celrev(pcode,x,y,&prj,&phi,&theta,&cel,ra,de)) {
printf("Error in Projection (celrev)\n");
return;
}
}
return;
}
// Compute Date from Julian Day // Compute Date from Julian Day
void mjd2date(double mjd,char *date) void mjd2date(double mjd,char *date)
{ {

View File

@ -3,6 +3,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <getopt.h> #include <getopt.h>
#include <ctype.h>
#include "sgdp4h.h" #include "sgdp4h.h"
#include "satutl.h" #include "satutl.h"

View File

@ -2,8 +2,8 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include "cel.h" #include <wcslib/cel.h>
#include "cpgplot.h" #include <cpgplot.h>
#include "qfits.h" #include "qfits.h"
#include <gsl/gsl_multifit.h> #include <gsl/gsl_multifit.h>
#include <getopt.h> #include <getopt.h>
@ -1377,42 +1377,6 @@ int fgetline(FILE *file,char *s,int lim)
return i; return i;
} }
// Get a x and y from a RA and Decl
void forward(double ra0,double de0,double ra,double de,double *x,double *y)
{
int i;
char pcode[4]="STG";
double phi,theta;
struct celprm cel;
struct prjprm prj;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
if (celset(pcode,&cel,&prj)) {
printf("Error in Projection (celset)\n");
return;
} else {
if (celfwd(pcode,ra,de,&cel,&phi,&theta,&prj,x,y)) {
printf("Error in Projection (celfwd)\n");
return;
}
}
*x *=3600.;
*y *=3600.;
return;
}
// Linear 2D fit // Linear 2D fit
void lfit2d(float *x,float *y,float *z,int n,float *a) void lfit2d(float *x,float *y,float *z,int n,float *a)
{ {
@ -1456,42 +1420,6 @@ void lfit2d(float *x,float *y,float *z,int n,float *a)
return; return;
} }
// Get a RA and Decl from x and y
void reverse(double ra0,double de0,double x,double y,double *ra,double *de)
{
int i;
char pcode[4]="STG";
double phi,theta;
struct celprm cel;
struct prjprm prj;
x/=3600.;
y/=3600.;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
if (celset(pcode,&cel,&prj)) {
printf("Error in Projection (celset)\n");
return;
} else {
if (celrev(pcode,x,y,&prj,&phi,&theta,&cel,ra,de)) {
printf("Error in Projection (celrev)\n");
return;
}
}
return;
}
// Read pixel catalog // Read pixel catalog
struct catalog read_pixel_catalog(char *filename) struct catalog read_pixel_catalog(char *filename)
{ {

View File

@ -2,6 +2,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <ctype.h>
#include "sgdp4h.h" #include "sgdp4h.h"
#include "satutl.h" #include "satutl.h"
#include <getopt.h> #include <getopt.h>

View File

@ -2,8 +2,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include "cel.h" #include <wcslib/cel.h>
#include "cpgplot.h" #include <cpgplot.h>
#include "qfits.h" #include "qfits.h"
#include "sgdp4h.h" #include "sgdp4h.h"
@ -235,7 +235,7 @@ struct track plot_satellite(orbit_t orb,struct image img)
imode=init_sgdp4(&orb); imode=init_sgdp4(&orb);
if (imode==SGDP4_ERROR) if (imode==SGDP4_ERROR)
return; return trk;
for (flag=0,textflag=0,i=0;i<MMAX;i++) { for (flag=0,textflag=0,i=0;i<MMAX;i++) {
t=img.exptime*(float) i/(float) (MMAX-1); t=img.exptime*(float) i/(float) (MMAX-1);
@ -249,7 +249,7 @@ struct track plot_satellite(orbit_t orb,struct image img)
if (r<90.0) if (r<90.0)
forward(img.ra0,img.de0,s.ra,s.de,&s.rx,&s.ry); forward(img.ra0,img.de0,s.ra,s.de,&s.rx,&s.ry);
else else
return; return trk;
// Convert image position // Convert image position
dx=s.rx-img.a[0]; dx=s.rx-img.a[0];
@ -686,75 +686,3 @@ double dgmst(double mjd)
return dgmst; return dgmst;
} }
// Get a x and y from a RA and Decl
void forward(double ra0,double de0,double ra,double de,double *x,double *y)
{
int i;
char pcode[4]="TAN";
double phi,theta;
struct celprm cel;
struct prjprm prj;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
if (celset(pcode,&cel,&prj)) {
printf("Error in Projection (celset)\n");
return;
} else {
if (celfwd(pcode,ra,de,&cel,&phi,&theta,&prj,x,y)) {
printf("Error in Projection (celfwd)\n");
return;
}
}
*x*=3600.;
*y*=3600.;
return;
}
// Get a RA and Decl from x and y
void reverse(double ra0,double de0,double x,double y,double *ra,double *de)
{
int i;
char pcode[4]="TAN";
double phi,theta;
struct celprm cel;
struct prjprm prj;
x/=3600.;
y/=3600.;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
if (celset(pcode,&cel,&prj)) {
printf("Error in Projection (celset)\n");
return;
} else {
if (celrev(pcode,x,y,&prj,&phi,&theta,&cel,ra,de)) {
printf("Error in Projection (celrev)\n");
return;
}
}
return;
}

View File

@ -2,6 +2,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <ctype.h>
#define LIM 128 #define LIM 128

View File

@ -3,8 +3,8 @@
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include <ctype.h> #include <ctype.h>
#include "cel.h" #include <wcslib/cel.h>
#include "cpgplot.h" #include <cpgplot.h>
#include "qfits.h" #include "qfits.h"
#define D2R M_PI/180.0 #define D2R M_PI/180.0
@ -1251,78 +1251,6 @@ struct image read_fits(char *filename)
return img; return img;
} }
// Get a x and y from a RA and Decl
void forward(double ra0,double de0,double ra,double de,double *x,double *y)
{
int i;
char pcode[4]="TAN";
double phi,theta;
struct celprm cel;
struct prjprm prj;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
if (celset(pcode,&cel,&prj)) {
printf("Error in Projection (celset)\n");
return;
} else {
if (celfwd(pcode,ra,de,&cel,&phi,&theta,&prj,x,y)) {
printf("Error in Projection (celfwd)\n");
return;
}
}
*x*=3600.;
*y*=3600.;
return;
}
// Get a RA and Decl from x and y
void reverse(double ra0,double de0,double x,double y,double *ra,double *de)
{
int i;
char pcode[4]="TAN";
double phi,theta;
struct celprm cel;
struct prjprm prj;
x/=3600.;
y/=3600.;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
if (celset(pcode,&cel,&prj)) {
printf("Error in Projection (celset)\n");
return;
} else {
if (celrev(pcode,x,y,&prj,&phi,&theta,&cel,ra,de)) {
printf("Error in Projection (celrev)\n");
return;
}
}
return;
}
// Compute Julian Day from Date // Compute Julian Day from Date
double date2mjd(int year,int month,double day) double date2mjd(int year,int month,double day)
{ {

View File

@ -3,7 +3,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <ctype.h> #include <ctype.h>
#include "cel.h" #include <wcslib/cel.h>
#include "sgdp4h.h" #include "sgdp4h.h"
#include <getopt.h> #include <getopt.h>
@ -350,7 +350,7 @@ struct site get_site(int site_id)
file=fopen(filename,"r"); file=fopen(filename,"r");
if (file==NULL) { if (file==NULL) {
printf("File with site information not found!\n"); printf("File with site information not found!\n");
return; return s;
} }
while (fgets(line,LIM,file)!=NULL) { while (fgets(line,LIM,file)!=NULL) {
// Skip // Skip
@ -566,35 +566,3 @@ struct data read_data(char *filename)
return d; return d;
} }
// Get a x and y from an AZI, ALT
void forward(double ra0,double de0,double ra,double de,double *x,double *y)
{
int i;
double phi,theta;
struct celprm cel;
struct prjprm prj;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
if (celset("STG",&cel,&prj)) {
printf("Error in Projection (celset)\n");
return;
} else {
if (celfwd("STG",ra,de,&cel,&phi,&theta,&prj,x,y)) {
printf("Error in Projection (celfwd)\n");
return;
}
}
return;
}

32
reverse.c 100644
View File

@ -0,0 +1,32 @@
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <wcslib/cel.h>
// Get a RA and Decl from x and y
void reverse(double ra0,double de0,double x,double y,double *ra,double *de)
{
int i,status;
double phi,theta;
struct celprm cel;
x/=3600.;
y/=3600.;
// Initialize Reference Angles
celini(&cel);
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
strcpy(cel.prj.code,"TAN");
if (celset(&cel)) {
printf("Error in Projection (celset)\n");
return;
}
celx2s(&cel,1,0,1,1,&x,&y,&phi,&theta,ra,de,&status);
return;
}

View File

@ -2,8 +2,9 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include "cpgplot.h" #include <ctype.h>
#include "cel.h" #include <cpgplot.h>
#include <wcslib/cel.h>
#include "sgdp4h.h" #include "sgdp4h.h"
#include <getopt.h> #include <getopt.h>
@ -127,7 +128,7 @@ xyz_t get_position(double r0,int i0)
return pos; return pos;
} }
int period_search(void) void period_search(void)
{ {
int i,j,i1,i2; int i,j,i1,i2;
float dt; float dt;
@ -1038,7 +1039,7 @@ struct site get_site(int site_id)
file=fopen(filename,"r"); file=fopen(filename,"r");
if (file==NULL) { if (file==NULL) {
printf("File with site information not found!\n"); printf("File with site information not found!\n");
return; return s;
} }
while (fgets(line,LIM,file)!=NULL) { while (fgets(line,LIM,file)!=NULL) {
// Skip // Skip
@ -1336,38 +1337,6 @@ struct doppler decode_doppler_observation(char *line)
return q; return q;
} }
// Get a x and y from an AZI, ALT
void forward(double ra0,double de0,double ra,double de,double *x,double *y)
{
int i;
double phi,theta;
struct celprm cel;
struct prjprm prj;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
if (celset("STG",&cel,&prj)) {
printf("Error in Projection (celset)\n");
return;
} else {
if (celfwd("STG",ra,de,&cel,&phi,&theta,&prj,x,y)) {
printf("Error in Projection (celfwd)\n");
return;
}
}
return;
}
// Read a line of maximum length int lim from file FILE into string s // Read a line of maximum length int lim from file FILE into string s
int fgetline(FILE *file,char *s,int lim) int fgetline(FILE *file,char *s,int lim)

75
satid.c
View File

@ -2,8 +2,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include "cel.h" #include <wcslib/cel.h>
#include "cpgplot.h" #include <cpgplot.h>
#include "qfits.h" #include "qfits.h"
#include "sgdp4h.h" #include "sgdp4h.h"
@ -669,74 +669,3 @@ double dgmst(double mjd)
return dgmst; return dgmst;
} }
// Get a x and y from a RA and Decl
void forward(double ra0,double de0,double ra,double de,double *x,double *y)
{
int i;
char pcode[4]="TAN";
double phi,theta;
struct celprm cel;
struct prjprm prj;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
if (celset(pcode,&cel,&prj)) {
printf("Error in Projection (celset)\n");
return;
} else {
if (celfwd(pcode,ra,de,&cel,&phi,&theta,&prj,x,y)) {
printf("Error in Projection (celfwd)\n");
return;
}
}
*x*=3600.;
*y*=3600.;
return;
}
// Get a RA and Decl from x and y
void reverse(double ra0,double de0,double x,double y,double *ra,double *de)
{
int i;
char pcode[4]="TAN";
double phi,theta;
struct celprm cel;
struct prjprm prj;
x/=3600.;
y/=3600.;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
if (celset(pcode,&cel,&prj)) {
printf("Error in Projection (celset)\n");
return;
} else {
if (celrev(pcode,x,y,&prj,&phi,&theta,&cel,ra,de)) {
printf("Error in Projection (celrev)\n");
return;
}
}
return;
}

View File

@ -75,6 +75,7 @@ double modulo(double,double);
void get_site(int site_id); void get_site(int site_id);
void ecliptical2equatorial(double l,double b,double *ra,double *de); void ecliptical2equatorial(double l,double b,double *ra,double *de);
void plot_launch_sites(void); void plot_launch_sites(void);
int fgetline(FILE *file,char *s,int lim);
// Initialize setup // Initialize setup
void initialize_setup(void) void initialize_setup(void)

View File

@ -5,8 +5,8 @@
#include <time.h> #include <time.h>
#include <getopt.h> #include <getopt.h>
#include <ctype.h> #include <ctype.h>
#include "cpgplot.h" #include <cpgplot.h>
#include "cel.h" #include <wcslib/cel.h>
#include "sgdp4h.h" #include "sgdp4h.h"
#define LIM 384 #define LIM 384
@ -149,7 +149,7 @@ void init_skymap(void)
FILE *file; FILE *file;
// Default Map parameters // Default Map parameters
m.azi0=0; m.azi0=180;
m.alt0=90.0; m.alt0=90.0;
m.w=120.0; m.w=120.0;
m.wl=180.0; m.wl=180.0;
@ -994,17 +994,12 @@ void skymap_plot_renew(void)
// Get a x and y from an AZI, ALT // Get a x and y from an AZI, ALT
void forward(double alpha,double delta,double *x,double *y) void forward(double alpha,double delta,double *x,double *y)
{ {
int i; int i,status;
double phi,theta; double phi,theta;
struct celprm cel; struct celprm cel;
struct prjprm prj;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles // Initialize Reference Angles
celini(&cel);
if (strcmp(m.orientation,"horizontal")==0) { if (strcmp(m.orientation,"horizontal")==0) {
cel.ref[0]=m.azi0; cel.ref[0]=m.azi0;
cel.ref[1]=m.alt0; cel.ref[1]=m.alt0;
@ -1015,17 +1010,14 @@ void forward(double alpha,double delta,double *x,double *y)
cel.ref[2]=999.; cel.ref[2]=999.;
cel.ref[3]=999.; cel.ref[3]=999.;
cel.flag=0.; cel.flag=0.;
strcpy(cel.prj.code,m.projection);
if (celset(m.projection,&cel,&prj)) { if (celset(&cel)) {
printf("Error in Projection (celset)\n"); printf("Error in Projection (celset)\n");
return; return;
} else {
if (celfwd(m.projection,alpha,delta,&cel,&phi,&theta,&prj,x,y)) {
printf("Error in Projection (celfwd)\n");
return;
}
} }
cels2x(&cel,1,0,1,1,&alpha,&delta,&phi,&theta,x,y,&status);
// Flip equatorial axis // Flip equatorial axis
if (strcmp(m.orientation,"equatorial")==0) if (strcmp(m.orientation,"equatorial")==0)
*x*=-1; *x*=-1;
@ -1036,21 +1028,16 @@ void forward(double alpha,double delta,double *x,double *y)
// Get an AZI, ALT from x and y // Get an AZI, ALT from x and y
void reverse(double x,double y,double *alpha,double *delta) void reverse(double x,double y,double *alpha,double *delta)
{ {
int i; int i,status;
double phi,theta; double phi,theta;
struct celprm cel; struct celprm cel;
struct prjprm prj;
// Flip equatorial axis // Flip equatorial axis
if (strcmp(m.orientation,"equatorial")==0) if (strcmp(m.orientation,"equatorial")==0)
x*=-1; x*=-1;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angless // Initialize Reference Angless
celini(&cel);
if (strcmp(m.orientation,"horizontal")==0) { if (strcmp(m.orientation,"horizontal")==0) {
cel.ref[0]=m.azi0; cel.ref[0]=m.azi0;
cel.ref[1]=m.alt0; cel.ref[1]=m.alt0;
@ -1061,20 +1048,17 @@ void reverse(double x,double y,double *alpha,double *delta)
cel.ref[2]=999.; cel.ref[2]=999.;
cel.ref[3]=999.; cel.ref[3]=999.;
cel.flag=0.; cel.flag=0.;
strcpy(cel.prj.code,m.projection);
if (celset(m.projection,&cel,&prj)) { if (celset(&cel)) {
printf("Error in Projection (celset)\n"); printf("Error in Projection (celset)\n");
return; return;
} else {
if (celrev(m.projection,x,y,&prj,&phi,&theta,&cel,alpha,delta)) {
printf("Error in Projection (celrev)\n");
return;
}
} }
celx2s(&cel,1,0,1,1,&x,&y,&phi,&theta,alpha,delta,&status);
return; return;
} }
// Greenwich Mean Sidereal Time // Greenwich Mean Sidereal Time
double gmst(double mjd) double gmst(double mjd)
{ {
@ -2679,7 +2663,7 @@ int plot_skymap(void)
// Polar // Polar
if (c=='z') { if (c=='z') {
m.azi0=0.0; m.azi0=180.0;
m.alt0=90.0; m.alt0=90.0;
m.w=120.0; m.w=120.0;
strcpy(m.orientation,"horizontal"); strcpy(m.orientation,"horizontal");

View File

@ -1,6 +1,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include <math.h> #include <math.h>
#include <getopt.h> #include <getopt.h>
#include <time.h> #include <time.h>

View File

@ -2,8 +2,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include "cel.h" #include <cpgplot.h>
#include "cpgplot.h"
#include "qfits.h" #include "qfits.h"
#define LIM 80 #define LIM 80

View File

@ -2,6 +2,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <ctype.h>
#define LIM 128 #define LIM 128

View File

@ -2,8 +2,8 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include "cel.h" #include <wcslib/cel.h>
#include "cpgplot.h" #include <cpgplot.h>
#include "qfits.h" #include "qfits.h"
#include <gsl/gsl_multifit.h> #include <gsl/gsl_multifit.h>
@ -208,43 +208,6 @@ struct catalog read_catalog(char *filename)
return c; return c;
} }
// Get a x and y from a RA and Decl
void forward(double ra0,double de0,double ra,double de,float *x,float *y)
{
int i;
char pcode[4]="TAN";
double phi,theta;
struct celprm cel;
struct prjprm prj;
double rx,ry;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
if (celset(pcode,&cel,&prj)) {
printf("Error in Projection (celset)\n");
return;
} else {
if (celfwd(pcode,ra,de,&cel,&phi,&theta,&prj,&rx,&ry)) {
printf("Error in Projection (celfwd)\n");
return;
}
}
*x=rx*3600.;
*y=ry*3600.;
return;
}
// Linear 2D fit // Linear 2D fit
void lfit2d(float *x,float *y,float *z,int n,float *a) void lfit2d(float *x,float *y,float *z,int n,float *a)
{ {
@ -288,43 +251,6 @@ void lfit2d(float *x,float *y,float *z,int n,float *a)
return; return;
} }
// Get a RA and Decl from x and y
void reverse(double ra0,double de0,float x,float y,double *ra,double *de)
{
int i;
char pcode[4]="TAN";
double phi,theta;
struct celprm cel;
struct prjprm prj;
double rx,ry;
rx=x/3600.;
ry=y/3600.;
// Initialize Projection Parameters
prj.flag=0;
prj.r0=0.;
for (i=0;i<10;prj.p[i++]=0.);
// Initialize Reference Angles
cel.ref[0]=ra0;
cel.ref[1]=de0;
cel.ref[2]=999.;
cel.ref[3]=999.;
cel.flag=0.;
if (celset(pcode,&cel,&prj)) {
printf("Error in Projection (celset)\n");
return;
} else {
if (celrev(pcode,rx,ry,&prj,&phi,&theta,&cel,ra,de)) {
printf("Error in Projection (celrev)\n");
return;
}
}
return;
}
// Add FITS keywords // Add FITS keywords
void add_fits_keywords(struct transformation t,char *filename) void add_fits_keywords(struct transformation t,char *filename)
{ {

View File

@ -3,6 +3,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <getopt.h> #include <getopt.h>
#include <ctype.h>
#include "sgdp4h.h" #include "sgdp4h.h"
#include "satutl.h" #include "satutl.h"
@ -27,6 +28,7 @@ struct point {
xyz_t r; xyz_t r;
}; };
orbit_t orb; orbit_t orb;
void versafit(int m,int n,double *a,double *da,double (*func)(double *),double dchisq,double tol,char *opt);
// Dot product // Dot product
float dot(xyz_t a,xyz_t b) float dot(xyz_t a,xyz_t b)