Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental patches to use PAL instead of C SLALIB #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ env = scons.makeEnv("mops_daymops",
["boost", "boost/test/included/unit_test.hpp"],
["pex_exceptions", "lsst/pex/exceptions/Exception.h lsst/pex/exceptions/Runtime.h", "pex_exceptions:C++"],
["gsl", "gsl/gsl_fit.h", "gslcblas gsl:C++"],
["slalib", "slalib.h slamac.h", "libsla:C++"],
["pal", "pal.h palmac.h", "libpal:C++"],
["eigen", "Eigen/Core.h"],
#["utils", "lsst/tr1/unordered_map.h", "utils:C++"],
#["daf_base", "lsst/daf/base/Citizen.h lsst/daf/base/Persistable.h", "daf_base:C++"],
Expand All @@ -25,7 +25,7 @@ env = scons.makeEnv("mops_daymops",
["python", "Python.h"]
])

env.libs["mops_daymops"] += env.getlibs("boost pex_exceptions gsl python slalib")
env.libs["mops_daymops"] += env.getlibs("boost pex_exceptions gsl python pal")

env['IgnoreFiles'] = r"(~$|\.pyc$|^\.svn$|\.o$)"

Expand Down
16 changes: 8 additions & 8 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
# choose your appropriate gcc compiler
GCC = c++

# if you compiled slalib as a shared library, use this OPT line
#OPT=-O3 -DNOPEX -fPIC -shared
# if you compiled slalib as a static library, use this OPT line
OPT=-O3 -DNOPEX
# if you compiled PAL as a shared library, use this OPT line
OPT=-O3 -DNOPEX -fPIC -shared
# if you compiled PAL as a static library, use this OPT line
#OPT=-O3 -DNOPEX
#if not using EUPS, then you'll probably uncomment these (otherwise just use eups to set them up first)
#THIRD=~/thirdPartyPrecompiled/
#EIGEN_DIR=${THIRD}eigen/
#BOOST_DIR=${THIRD}boost/
#GSL_DIR=/opt/gsl/gnu/
SLALIB_DIR = ../../slalib_C
PAL_DIR=${PAL_DIR}

EXTINCLUDES=-I ${EIGEN_DIR}/include/ -I ${BOOST_DIR}/include/ -I ${SLALIB_DIR}/include/ -I ${GSL_DIR}/include
EXTLIBDIRS=-L ${BOOST_DIR}/lib -L ${SLALIB_DIR}/lib -L ${GSL_DIR}/lib
EXTLIBS=-lgsl -lgslcblas -lslalib
EXTINCLUDES=-I ${EIGEN_DIR}/include/ -I ${BOOST_DIR}/include/ -I ${PAL_DIR}/include/ -I ${GSL_DIR}/include
EXTLIBDIRS=-L ${BOOST_DIR}/lib -L ${PAL_DIR}/lib -L ${GSL_DIR}/lib
EXTLIBS=-lgsl -lgslcblas -lpal

# we are being really suboptimal here and just recompiling EVERYTHING if any header changes. Fix this someday if it gets too painful
BASEINC=-I ../include/
Expand Down
12 changes: 6 additions & 6 deletions src/MopsDetection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#include "lsst/mops/Exceptions.h"

extern "C" {
#include "slalib.h"
#include "pal.h"
}
#include "slamac.h"
#include "palmac.h"

#undef DEBUG

Expand Down Expand Up @@ -200,17 +200,17 @@ void MopsDetection::calculateTopoCorr() {
obsLatRad = obsLat*DD2R;
obsLongRad = obsLong*DD2R;

double localAppSidTime = slaGmst(MJD - slaDt(slaEpj(MJD))/86400.0) + obsLongRad;
double localAppSidTime = palGmst(MJD - slaDt(palEpj(MJD))/86400.0) + obsLongRad;

double geoPosVel[6]; // observing position (and velocity) in AU, AU/sec
slaPvobs(obsLatRad, 0, localAppSidTime, geoPosVel);
palPvobs(obsLatRad, 0, localAppSidTime, geoPosVel);

double raRad, decRad;
raRad = RA*DD2R;
decRad = dec*DD2R;

float rho[3]; // geocentric unit 3-vector to object
slaCs2c(raRad, decRad, rho);
palCs2c(raRad, decRad, rho);

// add geoPos to rho (multiplied by 1 AU) to get the topocentric vector to the object
float rhoTopo[3];
Expand All @@ -221,7 +221,7 @@ void MopsDetection::calculateTopoCorr() {
// calculate the topocentric ra, dec

float raTopo, decTopo;
slaCc2s(rhoTopo, &raTopo, &decTopo);
palCc2s(rhoTopo, &raTopo, &decTopo);

double deltaRa = raTopo - raRad;

Expand Down
2 changes: 1 addition & 1 deletion ups/mops_daymops.table
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ setupRequired("swig")
setupRequired("gsl")
setupRequired("daf_base")
setupRequired(pex_exceptions)
setupRequired("slalib")
setupRequired("pal")
setupRequired("eigen" >=3.0.0)
setupRequired("mysqlpython")
setupRequired("numpy")
Expand Down