1 /*
2  # This file is part of the Astrometry.net suite.
3  # Licensed under a 3-clause BSD style license - see LICENSE
4  */
5 
6 #ifndef AUGMENT_XYLIST_H
7 #define AUGMENT_XYLIST_H
8 
9 #include <time.h>
10 
11 #include "astrometry/starxy.h"
12 #include "astrometry/an-bool.h"
13 #include "astrometry/bl.h"
14 #include "astrometry/an-opts.h"
15 
16 #define SCALE_UNITS_DEG_WIDTH 0
17 #define SCALE_UNITS_ARCMIN_WIDTH 1
18 #define SCALE_UNITS_ARCSEC_PER_PIX 2
19 #define SCALE_UNITS_FOCAL_MM 3
20 
21 struct augment_xylist_s {
22     char* tempdir;
23 
24     int verbosity;
25     anbool no_delete_temp;
26 
27     // contains ranges of depths as pairs of ints.
28     il* depths;
29     // contains ranges of fields as pairs of ints.
30     il* fields;
31 
32     int cutobjs;
33 
34     sl* verifywcs;
35     il* verifywcs_ext;
36 
37     sip_t* predistort;
38 
39     double pixel_xscale;
40 
41     // FITS columns copied from index to RDLS output
42     sl* tagalong;
43     anbool tagalong_all;
44 
45     // column to sort RDLS output by; prefix with "-" for descending order.
46     char* sort_rdls;
47 
48     // input files
49     char* imagefn;
50     char* xylsfn;
51     char* solvedinfn;
52 
53     anbool assume_fits_image;
54 
55     // output files
56     char* axyfn;
57     char* cancelfn;
58     char* solvedfn;
59     char* matchfn;
60     char* rdlsfn;
61     // SCAMP reference catalog
62     char* scampfn;
63     char* wcsfn;
64     char* corrfn;
65     char* keepxylsfn;
66     char* pnmfn;
67 
68     time_t wcs_last_mod;
69 
70     anbool keep_fitsimg;
71     char* fitsimgfn;
72     int fitsimgext;
73 
74     // FITS extension to read image from
75     int extension;
76 
77     // set during augment_xylist: is the input image or xyls FITS?
78     anbool isfits;
79 
80     anbool guess_scale;
81     anbool pnm;
82     anbool force_ppm;
83 
84     anbool use_source_extractor;
85     char* source_extractor_path;
86     char* source_extractor_config;
87 
88     int W;
89     int H;
90 
91     double scalelo;
92     double scalehi;
93 
94     int scaleunit;
95 
96     int parity;
97 
98     float cpulimit;
99 
100     anbool tweak;
101     int tweakorder;
102 
103     anbool no_removelines;
104     anbool no_bg_subtraction;
105 
106     int uniformize;
107 
108     anbool invert_image;
109 
110     float image_sigma;
111     float image_nsigma;
112 
113     char* xcol;
114     char* ycol;
115     char* sortcol;
116     char* bgcol;
117 
118     // WCS reference point
119     anbool set_crpix;
120     anbool set_crpix_center;
121     double crpix[2];
122 
123     anbool sort_ascending;
124     anbool resort;
125 
126     double codetol;
127     double pixelerr;
128 
129     double odds_to_tune_up;
130     double odds_to_solve;
131     double odds_to_bail;
132     double odds_to_stoplooking;
133 
134     int downsample;
135 
136     anbool dont_augment;
137 
138     anbool verify_uniformize;
139     anbool verify_dedup;
140 
141     // try to verify FITS input images?
142     anbool try_verify;
143 
144     // fractions
145     double quadsize_min;
146     double quadsize_max;
147 
148     // for searching only within indexes that are near some estimated position.
149     double ra_center;
150     double dec_center;
151     double search_radius;
152 };
153 typedef struct augment_xylist_s augment_xylist_t;
154 
155 int parse_scale_units(const char* str);
156 
157 int augment_xylist(augment_xylist_t* args,
158                    const char* executable_path);
159 
160 void augment_xylist_init(augment_xylist_t* args);
161 
162 void augment_xylist_free_contents(augment_xylist_t* args);
163 
164 void augment_xylist_print_help(FILE* fid);
165 
166 void augment_xylist_add_options(bl* opts);
167 
168 int augment_xylist_parse_option(char argchar, char* optarg, augment_xylist_t* axyargs);
169 
170 void augment_xylist_print_special_opts(an_option_t* opt, bl* opts,
171                                        int index,
172                                        FILE* fid, void* extra);
173 
174 #endif
175 
176 
177