Commit 75763e28 authored by Ole Streicher's avatar Ole Streicher
Browse files

Update upstream source from tag 'upstream/0.82+dfsg'

Update to upstream version '0.82+dfsg'
with Debian dir 5a29e7cca2f1bf513ec8343ffa22ba6f3c29d363
parents dad44a8d 238ce418
......@@ -6,36 +6,35 @@
*/test_*-main.c
**/*.pyc
__pycache__
blind/astrometry-engine
blind/augment-xylist
blind/build-astrometry-index
blind/fits-guess-scale
blind/fitscopy
blind/fitsverify
blind/get-wcs
blind/image2xy
blind/imarith
blind/imcopy
blind/imstat
blind/listhead
blind/liststruc
blind/modhead
blind/new-wcs
blind/plot-constellations
blind/plotquad
blind/plotstuff
blind/plotstuff_c.py
blind/plotstuff_wrap.c
blind/plotxy
blind/solve-field
blind/query-starkd
blind/tablist
blind/tabmerge
blind/test.c
blind/wcs-grab
blind/job.axy
blind/startree
blind/fitsverify.dSYM
solver/astrometry-engine
solver/augment-xylist
solver/build-astrometry-index
solver/fits-guess-scale
solver/fitscopy
solver/fitsverify
solver/get-wcs
solver/image2xy
solver/imarith
solver/imcopy
solver/imstat
solver/listhead
solver/liststruc
solver/modhead
solver/new-wcs
solver/solve-field
solver/query-starkd
solver/tablist
solver/tabmerge
solver/test.c
solver/wcs-grab
solver/job.axy
solver/startree
solver/fitsverify.dSYM
plot/plot-constellations
plot/plotquad
plot/plotstuff_c.py
plot/plotstuff_wrap.c
plot/plotxy
catalogs/2masstofits
catalogs/build-hd-tree
catalogs/nomadtofits
......
......@@ -18,6 +18,9 @@ language: python
python:
- "2.7"
- "3.5"
- "3.6"
- "3.7"
- "3.8"
env:
- CC=gcc
- CC=clang
......@@ -30,40 +33,36 @@ script:
- which pip
- python --version
- pip --version
#- export PYTHON=python$PY
#- export PIP=pip$PY
- export PYTHON=$(which python)
- export PIP=$(which pip)
- $PYTHON --version
- which $PYTHON
# - mkdir -p ~/bin
# - export PATH=~/bin:${PATH}
# - ls -l $(which python$PY)
# - ln -s $(which python$PY) ~/bin/python
- which $PIP
- $PIP --version
- $PIP install numpy #--user
- $PIP install fitsio #--user
- $PIP install numpy
- $PIP install fitsio
- $PYTHON -c "import numpy as np"
#- export WCSLIB_INC="-I/usr/include/wcslib-4.20"
#- export WCSLIB_LIB="-lwcs"
# quick py-only tests:
- export PYVER=$(python -c "from __future__ import print_function; import sys; print('%i.%i' % sys.version_info[:2])")
- if [ $PYVER != "2.7" ]; then PYTHONPATH=${PYTHONPATH}:. python util/timingpool.py; fi
- make
- make py
- make extra
- make test
- (cd util; ./test)
- (cd blind; ./test)
- (cd libkd; ./test)
- (cd util && ./test)
- (cd libkd && ./test)
- (cd solver && ./test)
- (cd plot && ./test)
- make install INSTALL_DIR=~/an PYTHON_SCRIPT="/usr/bin/env $PYTHON"
- ls ~/an/lib/python
- export PYTHONPATH=${PYTHONPATH}:~/an/lib/python
- (cd /tmp && $PYTHON -c "import astrometry.libkd.spherematch")
- export PATH=${PATH}:~/an/bin
- build-astrometry-index -d 3 -o index-9918.fits -P 18 -S mag -B 0.1 -s 0 -r 1 -I 9918 -M -i demo/tycho2-mag6.fits
- echo -e 'add_path .\ninparallel\nindex index-9918.fits' > 99.cfg
- solve-field --config 99.cfg demo/apod4.jpg --continue
- tablist demo/apod4.match
- listhead demo/apod4.wcs
- export PYTHONPATH=${PYTHONPATH}:~/an/lib/python
- $PYTHON -c "import astrometry.libkd.spherematch"
addons:
apt:
......@@ -77,7 +76,3 @@ addons:
- gsl-bin
- libgsl-dev
# trusty:
#- libcfitsio3
#- libcfitsio3-dev
# - libgsl0-dev
......@@ -38,24 +38,24 @@ Now, some miscellaneous files:
-sdss/yanny.py
(c) Ben Weaver
-blind/an_mm_malloc.h
-solver/an_mm_malloc.h
(c) FSF, from GCC. GPL v3+. Imported for use by ctmf.c
-blind/anet.py
-solver/anet.py
(c) Josh Bloom, licensed under GPL v3.
-blind/{tablist,modhead,fitscopy,tabmerge,fitstomatlab,liststruc,listhead,
-solver/{tablist,modhead,fitscopy,tabmerge,fitstomatlab,liststruc,listhead,
imcopy,imarith,imstat}.c
From the CFITSIO utilities web page.
http://heasarc.gsfc.nasa.gov/docs/software/fitsio/cexamples.html
"You may freely modify, reuse, and redistribute these programs as you wish."
(fitstomatlab.c is just a modified version of tablist.c)
-blind/fitsverify.c
-solver/fitsverify.c
From the "fitsverify" tool,
http://heasarc.gsfc.nasa.gov/docs/software/ftools/fitsverify/
-blind/pnpoly.c
-solver/pnpoly.c
(c) Wm. Randolph Franklin, MIT license
From http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
......
0.81:
All 'sextractor' command-line args renamed to 'source-extractor'.
The word "blind" (in the ableist sense in which we were using it)
has almost entirely been removed.
0.69:
Tiny bugfixes over 0.68
......
......@@ -30,7 +30,7 @@ COMMON := $(BASEDIR)/util
# The internal Astrometry.net dependency stack, top to bottom, is:
#
# blind/libastrometry.a -- astrometry.net core
# solver/libastrometry.a -- astrometry.net core
# catalogs/libcatalogs.a
# util/libanfiles.a -- astrometry.net index files, etc
# libkd/libkd.a -- kd-trees
......@@ -67,10 +67,10 @@ export SYSTEM_GSL
ifneq ($(SYSTEM_GSL),yes)
subdirs: gsl-an
blind: gsl-an
solver: gsl-an
endif
SUBDIRS := util catalogs libkd blind sdss qfits-an
SUBDIRS := util catalogs libkd solver sdss qfits-an plot
SUBDIRS_OPT := gsl-an
subdirs: $(SUBDIRS)
......@@ -81,7 +81,9 @@ libkd: config util
catalogs: config libkd
blind: config util catalogs libkd qfits-an
solver: config util catalogs libkd qfits-an
plot: config util catalogs libkd qfits-an
$(SUBDIRS):
$(MAKE) -C $@
......@@ -98,19 +100,18 @@ html:
$(MAKE) -C doc html
# Targets that require extra libraries
extra: qfits-an util catalogs blind-cairo
blind-cairo: cairoutils
$(MAKE) -C blind cairo
.PHONY: blind-cairo
extra: qfits-an util catalogs plot-extra
.PHONY: extra
plot-extra: cairoutils
$(MAKE) -C plot cairo
.PHONY: plot-extra
# Targets that create python bindings (requiring swig)
ifneq ($(SYSTEM_GSL),yes)
py: gsl-an
endif
py: catalogs pyutil libkd-spherematch sdss cairoutils pyplotstuff
py: catalogs pyutil libkd-spherematch sdss cairoutils pyplotstuff pysolver
libkd-spherematch:
$(MAKE) -C libkd pyspherematch
......@@ -119,9 +120,12 @@ cairoutils:
$(MAKE) -C util cairoutils.o
pyplotstuff: cairoutils
$(MAKE) -C blind pyplotstuff
$(MAKE) -C plot pyplotstuff
pysolver: cairoutils
$(MAKE) -C solver pysolver
.PHONY: py libkd-spherematch cairoutils pyplotstuff
.PHONY: py libkd-spherematch cairoutils pyplotstuff pysolver
pyutil: qfits-an
$(MAKE) -C util pyutil
......@@ -138,7 +142,8 @@ install: all report.txt
@echo
-$(MAKE) extra
-($(MAKE) -C util install || echo "\nErrors in the previous make command are not fatal -- we try to build and install some optional code.\n\n")
-($(MAKE) -C blind install-extra || echo "\nErrors in the previous make command are not fatal -- we try to build and install some optional code.\n\n")
-($(MAKE) -C solver install-extra || echo "\nErrors in the previous make command are not fatal -- we try to build and install some optional code.\n\n")
-($(MAKE) -C plot install-extra || echo "\nErrors in the previous make command are not fatal -- we try to build and install some optional code.\n\n")
@echo
install-core:
......@@ -158,7 +163,7 @@ install-core:
$(MAKE) -C catalogs install
$(MAKE) -C libkd install
$(MAKE) -C qfits-an install
$(MAKE) -C blind install
$(MAKE) -C solver install
$(MAKE) -C sdss install
$(MKDIR) -p '$(PY_BASE_INSTALL_DIR)'/net/client
@for x in net/client/client.py; do \
......@@ -217,7 +222,7 @@ config: util/os-features-config.h util/makefile.os-features
$(MAKE) -C util config
.PHONY: config
RELEASE_VER := 0.80
RELEASE_VER := 0.82
RELEASE_DIR := astrometry.net-$(RELEASE_VER)
RELEASE_RMDIRS := net
......@@ -229,10 +234,10 @@ release:
rm -R $(RELEASE_DIR)/$$x; \
done
(cd $(RELEASE_DIR)/util && swig -python -I. -I../include/astrometry util.i)
(cd $(RELEASE_DIR)/blind && swig -python -I. -I../util -I../include/astrometry plotstuff.i)
(cd $(RELEASE_DIR)/plot && swig -python -I. -I../util -I../include/astrometry plotstuff.i)
(cd $(RELEASE_DIR)/sdss && swig -python -I. cutils.i)
cat $(RELEASE_DIR)/util/makefile.common | sed "s/AN_GIT_REVISION .=.*/AN_GIT_REVISION := $$(git describe)/" | sed "s/AN_GIT_DATE .=.*/AN_GIT_DATE := $$(git log -n 1 --format=%cd | sed 's/ /_/g')/" > $(RELEASE_DIR)/util/makefile.common.x && mv $(RELEASE_DIR)/util/makefile.common.x $(RELEASE_DIR)/util/makefile.common
cat $(RELEASE_DIR)/Makefile | sed "s/RELEASE_VER := 0.80
cat $(RELEASE_DIR)/Makefile | sed "s/RELEASE_VER := 0.82
tar cf $(RELEASE_DIR).tar $(RELEASE_DIR)
gzip --best -c $(RELEASE_DIR).tar > $(RELEASE_DIR).tar.gz
bzip2 --best $(RELEASE_DIR).tar
......@@ -257,7 +262,7 @@ snapshot:
rm -R snapshot/$$x; \
done
(cd snapshot/util && swig -python -I. -I../include/astrometry util.i)
(cd snapshot/blind && swig -python -I. -I../util -I../include/astrometry plotstuff.i)
(cd snapshot/solver && swig -python -I. -I../util -I../include/astrometry plotstuff.i)
(cd snapshot/sdss && swig -python -I. cutils.i)
SSD=astrometry.net-$(shell date -u "+%Y-%m-%d-%H:%M:%S")-$(shell git describe); \
mv snapshot $$SSD; \
......@@ -339,7 +344,8 @@ test:
$(MAKE) -C util test
$(MAKE) -C catalogs test
$(MAKE) -C libkd test
$(MAKE) -C blind test
$(MAKE) -C solver test
$(MAKE) -C plot test
.PHONY: test
clean:
......@@ -350,8 +356,9 @@ clean:
$(MAKE) -C gsl-an clean
-rm gsl-an/config.h
$(MAKE) -C libkd clean
$(MAKE) -C blind clean
$(MAKE) -C solver clean
$(MAKE) -C sdss clean
$(MAKE) -C plot clean
realclean: clean
......
__version__ = '0.79-26-g3e790b81'
__version__ = '0.81-13-g1d112038'
/*
# This file is part of the Astrometry.net suite.
# Licensed under a 3-clause BSD style license - see LICENSE
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <sys/types.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include "an-bool.h"
#include "os-features.h"
#include <cairo.h>
#include "cairoutils.h"
#include "bl.h"
const char* OPTIONS = "hj:t:f:c:x:y:W:H:o:";
void print_help(char* progname) {
int i;
fprintf(stderr, "\nUsage: %s\n"
" -j <jpeg-filename>\n"
" -o <output-jpeg-filename>\n"
" -t <text>\n"
" -f <font>\n"
" -c <color>:\n"
, progname);
for (i=0;; i++) {
const char* color = cairoutils_get_color_name(i);
if (!color) break;
fprintf(stderr, " %s\n", color);
}
fprintf(stderr, " -x <x-center>\n"
" -y <y-center>\n"
" -W <width>\n"
" -H <height>\n");
}
int main(int argc, char** args) {
int c;
char* jpegfn = NULL;
char* outfn = NULL;
cairo_t* cairo = NULL;
cairo_surface_t* target = NULL;
double fontsize = 50.0;
int imW, imH;
double xc=-1, yc=-1, W=0, H=0;
unsigned char* img = NULL;
char* text = NULL;
char* font = "Purisa";
float r=1.0, g=1.0, b=1.0;
sl* lines;
char* cptr;
int i;
cairo_text_extents_t textents;
double txtw, txth;
double y;
int res;
double linespacing = 0.2;
while ((c = getopt(argc, args, OPTIONS)) != -1) {
switch (c) {
case 'h':
print_help(args[0]);
exit(0);
case 'j':
jpegfn = optarg;
break;
case 'o':
outfn = optarg;
break;
case 't':
text = optarg;
break;
case 'f':
font = optarg;
break;
case 'c':
if (cairoutils_parse_color(optarg, &r, &g, &b)) {
fprintf(stderr, "I didn't understand color \"%s\".\n", optarg);
exit(-1);
}
break;
case 'x':
xc = atof(optarg);
break;
case 'y':
yc = atof(optarg);
break;
case 'W':
W = atof(optarg);
break;
case 'H':
H = atof(optarg);
break;
default:
print_help(args[0]);
exit(-1);
}
}
if (!jpegfn || !outfn || !text) {
fprintf(stderr, "No jpeg input or output filename or text.\n");
print_help(args[0]);
exit(-1);
}
img = cairoutils_read_jpeg(jpegfn, &imW, &imH);
if (!img) {
fprintf(stderr, "Failed to read jpeg file %s.\n", jpegfn);
exit(-1);
}
if (xc == -1)
xc = imW/2;
if (yc == -1)
yc = imH/2;
if (W == 0)
W = imW;
if (H == 0)
H = imH;
fprintf(stderr, "Image size %i x %i\n", imW, imH);
fprintf(stderr, "Placing text at center (%g,%g), size (%g,%g)\n", xc, yc, W, H);
target = cairo_image_surface_create_for_data(img, CAIRO_FORMAT_ARGB32, imW, imH, imW*4);
cairo = cairo_create(target);
cairo_set_antialias(cairo, CAIRO_ANTIALIAS_GRAY);
cairo_set_source_rgb(cairo, r, g, b);
cairo_select_font_face(cairo, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size(cairo, fontsize);
// break the text into lines...
lines = sl_new(4);
cptr = text;
while (TRUE) {
char* nl = strchr(cptr, '\n');
if (!nl) {
sl_append(lines, cptr);
break;
}
sl_appendf(lines, "%.*s", (int)((nl - cptr) - 1), cptr);
cptr = nl + 1;
}
// Treat the string "\n" as a newline also.
for (i=0; i<sl_size(lines); i++) {
char* line = sl_get(lines, i);
char* nl = strstr(line, "\\n");
//fprintf(stderr, "line: %s. nl: %s\n", line, nl);
if (!nl)
continue;
sl_remove(lines, i);
sl_insertf(lines, i, "%.*s", (int)(nl - line), line);
sl_insertf(lines, i+1, "%s", nl + 2);
}
/*
fprintf(stderr, "%i lines:\n", sl_size(lines));
for (i=0; i<sl_size(lines); i++) {
char* line = sl_get(lines, i);
fprintf(stderr, " >>> %s <<<\n", line);
}
*/
for (;;) {
txtw = txth = 0.0;
for (i=0; i<sl_size(lines); i++) {
char* line = sl_get(lines, i);
cairo_text_extents(cairo, line, &textents);
txth += textents.height;
//
if (i)
txth += textents.height * linespacing;
txtw = MAX(txtw, textents.width);
}
fprintf(stderr, "font size %g, txt size = (%g, %g), max size (%g, %g)\n", fontsize, txtw, txth, W, H);
if (txtw > W || txth > H) {
double scale = MIN(W / txtw, H / txth);
fprintf(stderr, "scaling by %g\n", scale);
fontsize *= scale;
cairo_set_font_size(cairo, fontsize);
} else
break;
}
y = yc - txth/2.0;
for (i=0; i<sl_size(lines); i++) {
char* line = sl_get(lines, i);
cairo_text_extents(cairo, line, &textents);
cairo_move_to(cairo, xc - textents.width / 2.0, y + textents.height/2.0);
cairo_show_text(cairo, line);
cairo_stroke(cairo);
y += textents.height * (1.0 + linespacing);
}
if (strcmp(outfn, "-") == 0) {
res = cairoutils_stream_jpeg(stdout, img, imW, imH);
} else {
res = cairoutils_write_jpeg(outfn, img, imW, imH);
}
if (res) {
fprintf(stderr, "Failed to write jpeg to %s.\n", outfn);
exit(-1);
}
return 0;
}
/*
# This file is part of the Astrometry.net suite.
# Licensed under a 3-clause BSD style license - see LICENSE
*/
/*
Hackery for dstn's thesis - cairo pdf rendering of "plotxy" and "plotquad"
over a background image.
*/
#include <math.h>
#include <string.h>
#include <stdint.h>
#include <cairo.h>
#include <cairo-pdf.h>
#include <cairo-ps.h>
#include "xylist.h"
#include "matchfile.h"
#include "permutedsort.h"
#include "boilerplate.h"
#include "cairoutils.h"
#include "log.h"
#include "errors.h"
static const char* OPTIONS = "hvj:x:m:W:H:s:E";
static void printHelp(char* progname) {
fprintf(stderr, "\nUsage: %s [options] > output.pdf\n"
" -j <jpeg filename>\n"
" -x <xylist filename>\n"
" -m <match filename>\n"
" [-W <output width (points)>]\n"
" [-H <output height (points)>]\n"
" [-s <xylist-sale-factor>]\n"
" [-E]: EPS output\n"
"\n", progname);
}
int main(int argc, char *args[]) {
int argchar;
char* progname = args[0];
int outW=0, outH=0;
int W, H;
unsigned char* img = NULL;
cairo_t* cairo;
cairo_surface_t* target;
xylist_t* xyls;
starxy_t* xy;
int Nxy;
int Nstars;
int ext = 1;
double xoff, yoff;
double scalexy = 1.0;
float br, bg, bb;
float r, g, b;
double rad;
double lw;
int marker;
int i;
int nquads;
int dimquads = 4;
dl* coords;
int loglvl = LOG_MSG;
double sx, sy;
anbool eps = FALSE;
/*
# | plotxy -i m88.xy -I - -x 1 -y 1 -b white -C black -N 100 -r 10 -w 2 -P \
# | plotquad -I - -C black -m m88-${I2}.match -P \
*/
char* bgimgfn = NULL;
char* xylsfn = NULL;
char* matchfn = NULL;
while ((argchar = getopt(argc, args, OPTIONS)) != -1)
switch (argchar) {
case 'E':
eps = TRUE;
break;
case 'j':
bgimgfn = optarg;
break;
case 'x':
xylsfn = optarg;
break;
case 'm':
matchfn = optarg;
break;
case 'W':
outW = atoi(optarg);
break;
case 'H':
outH = atoi(optarg);
break;
case 's':
scalexy = atof(optarg);
break;
case 'h':
printHelp(progname);
exit(0);
case 'v':
loglvl++;
break;
}
log_init(LOG_MSG);
log_to(stderr);
errors_log_to(stderr);
if (!(bgimgfn && xylsfn && matchfn)) {
ERROR("Must specify background jpeg, xyls, and match filenames.\n");
printHelp(progname);
exit(-1);
}
Nstars = 100;
xoff = yoff = 1.0;
r = g = b = 0.0;
br = bg = bb = 1.0;
rad = 6;
lw = 2;
marker = CAIROUTIL_MARKER_CIRCLE;
W = H = -1;
coords = dl_new(16);
// read bg image to get size.
img = cairoutils_read_jpeg(bgimgfn, &W, &H);
if (!img) {
ERROR("Failed to read background image \"%s\"", bgimgfn);
exit(-1);
}
logmsg("Read \"%s\": %ix%i pixels\n", bgimgfn, W, H);
xyls = xylist_open(xylsfn);
if (!xyls) {
ERROR("Failed to read xylist \"%s\"", xylsfn);
exit(-1);
}
if (!outW)
outW = W;
if (!outH)
outH = H;
logmsg("Background image aspect ratio %g; output file aspect ratio %g.\n", W/(float)H, outW/(float)outH);
// create output buffer.
if (eps) {
target = cairo_ps_surface_create_for_stream(cairoutils_file_write_func, stdout, outW, outH);
cairo_ps_surface_set_eps(target, TRUE);
} else {
target = cairo_pdf_surface_create_for_stream(cairoutils_file_write_func, stdout, outW, outH);
}
if (!target) {
ERROR("Failed to create cairo surface");
exit(-1);
}
cairo = cairo_create(target);
sx = outW/(float)W;
sy = outH/(float)H;
cairo_set_line_width(cairo, lw);
cairo_set_antialias(cairo, CAIRO_ANTIALIAS_GRAY);
cairoutils_surface_status_errors(target);
cairoutils_cairo_status_errors(cairo);
// render image.
{
cairo_surface_t* thissurf;
cairo_pattern_t* pat;
cairoutils_rgba_to_argb32(img, W, H);
thissurf = cairo_image_surface_create_for_data(img, CAIRO_FORMAT_ARGB32, W, H, W*4);
pat = cairo_pattern_create_for_surface(thissurf);
logmsg("Scaling image by factors %g, %g\n", sx, sy);
cairo_save(cairo);
cairo_scale(cairo, sx, sy);
cairo_set_source(cairo, pat);
cairo_paint(cairo);
cairo_restore(cairo);
cairo_pattern_destroy(pat);
cairo_surface_destroy(thissurf);
}
free(img);
// render xylist.
// we don't care about FLUX and BACKGROUND columns.
xylist_set_include_flux(xyls, FALSE);
xylist_set_include_background(xyls, FALSE);
// Find number of entries in xylist.
xy = xylist_read_field_num(xyls, ext, NULL);
if (!xy) {
ERROR("Failed to read FITS extension %i from file %s", ext, xylsfn);
exit(-1);
}
Nxy = starxy_n(xy);
logmsg("Xylist contains %i stars\n", Nxy);
// If N is specified, apply it as a max.
if (Nstars) {
if (Nstars < Nxy)
logmsg("Keeping %i stars.\n", Nstars);
Nxy = MIN(Nxy, Nstars);
}
cairo_set_source_rgb(cairo, r, g, b);
// render background markers.
cairo_save(cairo);
cairo_set_line_width(cairo, lw+2.0);
//cairo_set_source_rgba(cairo, br, bg, bb, 0.75);
cairo_set_source_rgba(cairo, br, bg, bb, 1.0);
for (i=0; i<Nxy; i++) {
double x = (starxy_getx(xy, i) - xoff) * sx * scalexy + 0.5;
double y = (starxy_gety(xy, i) - yoff) * sy * scalexy + 0.5;
cairoutils_draw_marker(cairo, marker, x, y, rad);
cairo_stroke(cairo);
}
cairo_restore(cairo);
// Draw markers.
for (i=0; i<Nxy; i++) {
double x = (starxy_getx(xy, i) - xoff) * sx * scalexy + 0.5;
double y = (starxy_gety(xy, i) - yoff) * sy * scalexy + 0.5;
cairoutils_draw_marker(cairo, marker, x, y, rad);
cairo_stroke(cairo);
}
starxy_free(xy);
xylist_close(xyls);
// Plot quad.
{
matchfile* mf = matchfile_open(matchfn);
MatchObj* mo;
if (!mf) {
ERROR("Failed to open matchfile \"%s\"", matchfn);
exit(-1);
}
while (1) {
mo = matchfile_read_match(mf);
if (!mo)
break;
for (i=0; i<2*dimquads; i++) {
dl_append(coords, mo->quadpix[i]);
}
}
}
nquads = dl_size(coords) / (2*dimquads);
lw = 4;
cairo_set_line_width(cairo, lw);
cairo_set_line_join(cairo, CAIRO_LINE_JOIN_BEVEL);
for (i=0; i<nquads; i++) {
int j;
double theta[dimquads];
int perm[dimquads];
double cx, cy;
// Make the quad convex so Sam's eyes don't bleed.
cx = cy = 0.0;
for (j=0; j<dimquads; j++) {
cx += dl_get(coords, i*(2*dimquads) + j*2);
cy += dl_get(coords, i*(2*dimquads) + j*2 + 1);
}
cx /= dimquads;
cy /= dimquads;
for (j=0; j<dimquads; j++) {
theta[j] = atan2(dl_get(coords, i*(2*dimquads) + j*2 + 1)-cy,
dl_get(coords, i*(2*dimquads) + j*2 + 0)-cx);
}
permutation_init(perm, dimquads);
permuted_sort(theta, sizeof(double), compare_doubles_asc, perm, dimquads);
for (j=0; j<dimquads; j++) {
((j==0) ? cairo_move_to : cairo_line_to)
(cairo,
(dl_get(coords, i*(2*dimquads) + perm[j]*2)
- xoff) * sx * scalexy + 0.5,
(dl_get(coords, i*(2*dimquads) + perm[j]*2 + 1)
- yoff) * sy * scalexy + 0.5);
}
cairo_close_path(cairo);
cairo_stroke(cairo);
}
// do output & clean up.
cairo_surface_flush(target);
cairo_surface_finish(target);
cairoutils_surface_status_errors(target);
cairoutils_cairo_status_errors(cairo);
cairo_surface_destroy(target);
cairo_destroy(cairo);
return 0;
}
/*
# This file is part of the Astrometry.net suite.
# Licensed under a 3-clause BSD style license - see LICENSE
*/
#include <string.h>
#include <math.h>
#include "plotcoadd.h"
#include "cairoutils.h"
#include "ioutils.h"
#include "log.h"
#include "errors.h"
const plotter_t plotter_coadd = {
.name = "coadd",
.init = plot_coadd_init,
.command = plot_coadd_command,
.doplot = plot_coadd_plot,
.free = plot_coadd_free
};
plotcoadd_t* plot_coadd_get(plot_args_t* pargs) {
return plotstuff_get_config(pargs, "coadd");
}
void* plot_coadd_init(plot_args_t* plotargs) {
plotcoadd_t* args = calloc(1, sizeof(plotcoadd_t));
return args;
}
int plot_coadd_plot(const char* command,
cairo_t* cairo, plot_args_t* pargs, void* baton) {
plotcoadd_t* args = (plotcoadd_t*)baton;
return 0;
}
int plot_coadd_command(const char* cmd, const char* cmdargs,
plot_args_t* pargs, void* baton) {
plotcoadd_t* args = (plotcoadd_t*)baton;
if (streq(cmd, "coadd_file")) {
//plot_image_set_filename(args, cmdargs);
} else {
ERROR("Did not understand command \"%s\"", cmd);
return -1;
}
return 0;
}
void plot_coadd_free(plot_args_t* plotargs, void* baton) {
plotcoadd_t* args = (plotcoadd_t*)baton;
free(args);
}
/*
# This file is part of the Astrometry.net suite.
# Licensed under a 3-clause BSD style license - see LICENSE
*/
#ifndef PLOTCOADD_H
#define PLOTCOADD_H
#include "astrometry/plotstuff.h"
struct plotcoadd_args {
};
typedef struct plotcoadd_args plotcoadd_t;
plotcoadd_t* plot_coadd_get(plot_args_t* pargs);
void* plot_coadd_init(plot_args_t* args);
int plot_coadd_command(const char* command, const char* cmdargs,
plot_args_t* args, void* baton);
int plot_coadd_plot(const char* command, cairo_t* cr,
plot_args_t* args, void* baton);
void plot_coadd_free(plot_args_t* args, void* baton);
#endif
......@@ -106,7 +106,7 @@ example, doing an initial photometric calibration by tagging-along one
or more bands of photometric data for each astrometric star.
As an example, the file
`2mass-cut.py <http://trac.astrometry.net/browser/trunk/src/astrometry/blind/2mass-cut.py>`_
`2mass-cut.py <https://github.com/dstndstn/astrometry.net/blob/master/solver/2mass-cut.py>`_
implements the cut we used to build our 2MASS-based index files. It
removes any stars that are flagged in the 2MASS catalog (low quality,
contaminated, etc), and writes out just the RA,Dec, and J-magnitude
......@@ -157,7 +157,7 @@ The number of healpix tiles is determined by the *Nside* (-n) option.
into 48 pieces. You probably don't want to go any finer than that.
For reference, maps of the healpix tiles are here:
`Nside=1 healpixes <http://trac.astrometry.net/browser/trunk/src/astrometry/util/hp.png>`_;
`Nside=1 healpixes <https://github.com/dstndstn/astrometry.net/blob/master/util/hp.png>`_;
`Nside=2 healpixes <http://trac.astrometry.net/browser/trunk/src/astrometry/util/hp2.png>`_.
You probably want to set ``-m`` for the *margin* -- extra overlapping
......@@ -316,7 +316,7 @@ Presets in the range -5 to 19 are available. The scales for the presets are lis
Rather than use the ``-P`` option it is possible to specify separately
the different scales using ``-N``, ``-l``, ``-u``, ``-U``, but I wouldn't
recommend it. The presets are listed in
`<build-index-main.c healpixes http://trac.astrometry.net/browser/trunk/src/astrometry/blind/build-index-main.c>`_.
`<build-index-main.c healpixes https://github.com/dstndstn/astrometry.net/blob/master/solver/build-index-main.c>`_.
**Sort column**::
......
......@@ -6,7 +6,7 @@ Astrometry.net code structure
This is meant to be an introduction to what parts of the codebase run
during a solve.
*blind/solve-field.c*
*solver/solve-field.c*
---------------------
* parses command-line args
......@@ -17,7 +17,7 @@ during a solve.
* runs *astrometry-engine* to actually do the solve
* produces plots (*-objs.png, *-ngc.png, etc)
*blind/augment-xylist.c*
*solver/augment-xylist.c*
------------------------
A field to solve is encapsulated in an "axy" file, which is a FITS
......@@ -35,7 +35,7 @@ creates these "axy" files.
* run *uniformize.py* to select a spatially uniform subset of stars
* add headers to xylist to create axy file
*blind/engine-main.c*
*solver/engine-main.c*
---------------------
This is the *astrometry-engine* executable.
......@@ -45,19 +45,19 @@ This is the *astrometry-engine* executable.
* reads axy file
* runs *engine_run_job()* to actually do the solve
*blind/engine.c*
*solver/engine.c*
----------------
*engine_run_job()*
* parses axy file
* based on range of image scales, selects index files to use
* calls *blind_run()*
* calls *onefield_run()*
*blind/blind.c*
*solver/onefield.c*
---------------
*blind_run()*
*onefield_run()*
Runs a set of fields with a set of index files.
......@@ -71,7 +71,7 @@ Runs a set of fields with a set of index files.
* calls *solver_preprocess_field()*
* calls *solver_run()*
*blind/solver.c*
*solver/solver.c*
----------------
Runs a single field with a set of index files.
......@@ -118,7 +118,7 @@ Runs a single field with a set of index files.
* calls *verify_hit()* to confirm the match
* if matched, calls *solver_tweak2()* to compute SIP coefficients
*blind/verify.c*
*solver/verify.c*
----------------
*verify_hit()*
......
......@@ -4,20 +4,19 @@ WORKSPACE_DIR="/tmp"
# basic linux install/build libs, python, and other support
cd $WORKSPACE_DIR && \
apt install -y make && \
apt-get update && \
apt-get install -y build-essential python python-pip netpbm zlib1g-dev libcairo2-dev libjpeg-dev libcfitsio-dev && \
pip install numpy scipy pyfits && \
apt update && \
apt install -y make build-essential python3 python3-pip netpbm libnetpbm10-dev zlib1g-dev libcairo2-dev libjpeg-dev libcfitsio-dev libbz2-dev wget wcslib-dev && \
pip3 install numpy scipy fitsio && \
# astrometry
rm -f astrometry.net-latest.tar.gz* && \
wget http://astrometry.net/downloads/astrometry.net-latest.tar.gz && \
tar xvzf astrometry.net-latest.tar.gz && \
cd astrometry.net-* && \
make CFITS_INC="-I$WORKSPACE_DIR/cfitsio/include" CFITS_LIB="-L$WORKSPACE_DIR/cfitsio/lib -lcfitsio" && \
make && \
make py && \
make extra && \
make CFITS_INC="-I$WORKSPACE_DIR/cfitsio/include" CFITS_LIB="-L$WORKSPACE_DIR/cfitsio/lib -lcfitsio" install && \
make install && \
# download and install index files
rm -rf /usr/local/astrometry/data/* && \
......
......@@ -165,7 +165,7 @@ to log in::
# id_nova_backend
#
command="cd /home/solve/nova/blind; ../net/testscript-astro",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa AAAA[.....] nova@webserver
command="cd /home/solve/nova/solver; ../net/testscript-astro",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa AAAA[.....] nova@webserver
That script
(https://github.com/dstndstn/astrometry.net/blob/master/net/testscript-astro)
......
......@@ -399,7 +399,7 @@ Tricks and Tips
* When solve-field processes FITS images, it looks for an existing
WCS header. If one is found, it tries to verify that header before
trying to solve the image blindly. You can prevent this with::
trying to solve the image all-sky. You can prevent this with::
$ solve-field --no-verify ...
......@@ -518,11 +518,10 @@ Image-solving programs:
^^^^^^^^^^^^^^^^^^^^^^^
* solve-field: main high-level command-line user interface.
* backend: higher-level solver that reads "augmented xylists";
* astrometry-engine: higher-level solver that reads "augmented xylists";
called by solve-field.
* augment-xylist: creates "augmented xylists" from images, which
include star positions and hints and instructions for solving.
* blind: low-level command-line solver.
* image2xy: source extractor.
Plotting programs:
......@@ -683,25 +682,25 @@ solve-field to use this config file::
$ solve-field --config myastrometry.cfg ...
SExtractor
----------
Source Extractor
----------------
http://www.astromatic.net/software/sextractor
The "Source Extractor" aka "SExtractor" program by Emmanuel Bertin can
The "Source Extractor" program by Emmanuel Bertin can
be used to do source extraction if you don't want to use our own
bundled "image2xy" program.
NOTE: users have reported that SExtractor 2.4.4 (available in some
NOTE: users have reported that Source Extractor 2.4.4 (available in some
Ubuntu distributions) DOES NOT WORK -- it prints out correct source
positions as it runs, but the "xyls" output file it produces contains
all (0,0). We haven't looked into why this is or how to work around
it. Later versions of SExtractor such as 2.8.6 work fine.
it. Later versions of Source Extractor such as 2.8.6 work fine.
You can tell solve-field to use SExtractor like this::
You can tell solve-field to use Source Extractor like this::
$ solve-field --use-sextractor ...
$ solve-field --use-source-extractor ...
By default we use almost all SExtractor's default settings. The
By default we use almost all Source Extractor's default settings. The
exceptions are:
1) We write a PARAMETERS_NAME file containing:
......@@ -710,7 +709,7 @@ exceptions are:
MAG_AUTO
2) We write a FILTER_NAME file containing a Gaussian PSF with FWHM
of 2 pixels. (See blind/augment-xylist.c "filterstr" for the
of 2 pixels. (See solver/augment-xylist.c "filterstr" for the
exact string.)
3) We set CATALOG_TYPE FITS_1.0
......@@ -720,7 +719,7 @@ exceptions are:
If you want to override any of the settings we use, you can use::
$ solve-field --use-sextractor --sextractor-config <sex.conf>
$ solve-field --use-source-extractor --source-extractor-config <se.conf>
In order to reproduce the default behavior, you must::
......@@ -736,9 +735,9 @@ In order to reproduce the default behavior, you must::
its filename
Note that you can tell solve-field where to find SExtractor with::
Note that you can tell solve-field where to find Source Extractor with::
$ solve-field --use-sextractor --sextractor-path <path-to-sex-executable>
$ solve-field --use-source-extractor --source-extractor-path <path-to-se-executable>
......@@ -761,7 +760,7 @@ Workarounds
If you don't have these programs installed, you must do source
extraction yourself and use "xylists" rather than images as the input
to solve-field. See SEXTRACTOR and XYLIST sections above.
to solve-field. See SOURCE EXTRACTOR and XYLIST sections above.
ERROR MESSAGES during compiling
-------------------------------
......
Docker containers for Astrometry.net
(cd solver && docker build -t astrometrynet/solver:latest .)
(cd webservice && docker build -t astrometrynet/webservice:latest .)
docker run --net=host astrometrynet/webservice
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt -y update && apt install -y apt-utils && \
apt install -y --no-install-recommends \
build-essential \
make \
gcc \
git \
file \
pkg-config \
wget \
curl \
swig \
netpbm \
wcslib-dev \
wcslib-tools \
zlib1g-dev \
libbz2-dev \
libcairo2-dev \
libcfitsio-dev \
libcfitsio-bin \
libgsl-dev \
libjpeg-dev \
libnetpbm10-dev \
libpng-dev \
python3 \
python3-dev \
python3-pip \
python3-pil \
python3-tk \
python3-setuptools \
python3-wheel \
python3-numpy \
python3-scipy \
python3-matplotlib \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Pip installs
RUN for x in \
fitsio \
astropy \
; do pip3 install --no-cache-dir $x; done
RUN mkdir /src
WORKDIR /src
# Astrometry.net
RUN git clone http://github.com/dstndstn/astrometry.net.git astrometry \
&& cd astrometry \
&& make \
&& make py \
&& make extra \
&& make install INSTALL_DIR=/usr/local \
&& make clean
# python = python3
RUN ln -s /usr/bin/python3 /usr/bin/python
ENV PYTHONPATH=/usr/local/lib/python
FROM astrometrynet/solver:latest
RUN pip3 install --no-cache-dir Django
ENV DEBIAN_FRONTEND=noninteractive
RUN apt -y update && \
apt install -y --no-install-recommends \
apache2 \
libapache2-mod-wsgi-py3 \
less \
emacs-nox
RUN pip3 install --no-cache-dir \
social-auth-core django-social-auth3 social-auth-app-django
WORKDIR /src/astrometry/net
RUN ln -s settings_test.py settings.py
# Yuck! The installed 'astrometry' package conflicts with '.', so paste it in...
RUN rm -R /usr/local/lib/python/astrometry/net && \
ln -s /src/astrometry/net /usr/local/lib/python/astrometry/net
RUN mkdir appsecrets && \
touch appsecrets/__init__.py && \
touch appsecrets/auth.py
COPY django_db.py /src/astrometry/net/appsecrets/
RUN git stash && git pull
RUN mv migrations/* /tmp && \
python manage.py makemigrations && \
python manage.py migrate && \
python manage.py makemigrations net && \
python manage.py migrate net && \
python manage.py loaddata fixtures/initial_data.json && \
python manage.py loaddata fixtures/flags.json
CMD python manage.py runserver
EXPOSE 8000
DATABASE_USER=''
DATABASE_PASSWORD=''
DATABASE_HOST=''
DATABASE_PORT=12345
......@@ -81,9 +81,9 @@ struct augment_xylist_s {
anbool pnm;
anbool force_ppm;
anbool use_sextractor;
char* sextractor_path;
char* sextractor_config;
anbool use_source_extractor;
char* source_extractor_path;
char* source_extractor_config;
int W;
int H;
......
Supports Markdown
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