From 0a56335443de262279698a68577f1709326ed3ab Mon Sep 17 00:00:00 2001 From: Sasha Rahlin Date: Wed, 25 Oct 2023 18:08:30 -0500 Subject: [PATCH] Remove unnecessary maps header --- maps/include/maps/maputils.h | 60 ------------------------------------ maps/src/maputils.cxx | 22 +++++++------ maps/src/python.cxx | 2 -- 3 files changed, 12 insertions(+), 72 deletions(-) delete mode 100644 maps/include/maps/maputils.h diff --git a/maps/include/maps/maputils.h b/maps/include/maps/maputils.h deleted file mode 100644 index c8935ca8..00000000 --- a/maps/include/maps/maputils.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef _MAPS_MAPUTILS_H -#define _MAPS_MAPUTILS_H - -#include - -#include - -#include -#include - -// Divide out map weights from the sky maps -void RemoveWeightsT(G3SkyMapPtr T, G3SkyMapWeightsConstPtr W, bool zero_nans = false); -void RemoveWeights(G3SkyMapPtr T, G3SkyMapPtr Q, G3SkyMapPtr U, G3SkyMapWeightsConstPtr W, - bool zero_nans = false); - -// Apply map weights to sky maps -void ApplyWeightsT(G3SkyMapPtr T, G3SkyMapWeightsConstPtr W); -void ApplyWeights(G3SkyMapPtr T, G3SkyMapPtr Q, G3SkyMapPtr U, G3SkyMapWeightsConstPtr W); - -// Return maps of RA and Dec coordinates for each pixel in the input map -boost::python::tuple GetRaDecMap(G3SkyMapConstPtr m); - -// Return a mask that is one for all pixels in the input map that are within the -// given ra and dec rectangular bounds, and zero otherwise -G3SkyMapMaskPtr GetRaDecMask(G3SkyMapConstPtr m, double ra_left, double ra_right, - double dec_bottom, double dec_top); - -// Reproject the input map onto the output map grid, optionally -// oversampling the output pixels by the rebin factor, and/or sampling the input map -// with interpolation -void ReprojMap(G3SkyMapConstPtr in_map, G3SkyMapPtr out_map, int rebin=1, bool interp=false); - -// Flatten or unflatten Q and U polarization maps using the polarization gradient across the map. -// The h parameter controls the pixel width over which a gradient is computed. -void FlattenPol(FlatSkyMapPtr Q, FlatSkyMapPtr U, G3SkyMapWeightsPtr W=NULL, double h=0.001, bool invert=false); - -// Compute map moments up to fourth order (mean, var, skewness, kurtosis) of the input map, -// optionally excluding any pixels that are zero in the input mask, or zero/nan/inf in the input map -std::vector GetMapMoments(G3SkyMapConstPtr m, G3SkyMapMaskConstPtr mask=NULL, int order=2, - bool ignore_zeros=false, bool ignore_nans=false, bool ignore_infs=false); - -// Compute the histogram of the input map pixels, grouping the values into bins -// defined by the array of bin edges, and optionally excluding any pixels that are -// zero in the input mask, or zero/nan/inf in the input map -std::vector GetMapHist(G3SkyMapConstPtr m, const std::vector &bin_edges, - G3SkyMapMaskConstPtr mask=NULL, bool ignore_zeros=false, bool ignore_nans=false, - bool ignore_infs=false); - -// Convolve the input flat sky map with a filter kernel -FlatSkyMapPtr ConvolveMap(FlatSkyMapConstPtr map, FlatSkyMapConstPtr kernel); - -// Point source masking -G3SkyMapMaskPtr -MakePointSourceMask(G3SkyMapConstPtr map, const std::vector & ra, - const std::vector & dec, const std::vector & radius); - -// Python bindings -void maputils_pybindings(void); - -#endif //_MAPS_MAPUTILS_H diff --git a/maps/src/maputils.cxx b/maps/src/maputils.cxx index 61a83aff..ffd42f2e 100644 --- a/maps/src/maputils.cxx +++ b/maps/src/maputils.cxx @@ -8,7 +8,8 @@ #include #include -#include +#include +#include #include #include @@ -19,11 +20,6 @@ using namespace G3Units; -void RemoveWeightsT(G3SkyMapPtr T, G3SkyMapWeightsConstPtr W, bool zero_nans) -{ - RemoveWeights(T, NULL, NULL, W, zero_nans); -} - void RemoveWeights(G3SkyMapPtr T, G3SkyMapPtr Q, G3SkyMapPtr U, G3SkyMapWeightsConstPtr W, bool zero_nans) { @@ -100,9 +96,9 @@ void RemoveWeights(G3SkyMapPtr T, G3SkyMapPtr Q, G3SkyMapPtr U, G3SkyMapWeightsC } } -void ApplyWeightsT(G3SkyMapPtr T, G3SkyMapWeightsConstPtr W) +void RemoveWeightsT(G3SkyMapPtr T, G3SkyMapWeightsConstPtr W, bool zero_nans) { - ApplyWeights(T, NULL, NULL, W); + RemoveWeights(T, NULL, NULL, W, zero_nans); } void ApplyWeights(G3SkyMapPtr T, G3SkyMapPtr Q, G3SkyMapPtr U, G3SkyMapWeightsConstPtr W) @@ -139,6 +135,11 @@ void ApplyWeights(G3SkyMapPtr T, G3SkyMapPtr Q, G3SkyMapPtr U, G3SkyMapWeightsCo } } +void ApplyWeightsT(G3SkyMapPtr T, G3SkyMapWeightsConstPtr W) +{ + ApplyWeights(T, NULL, NULL, W); +} + boost::python::tuple GetRaDecMap(G3SkyMapConstPtr m) { @@ -526,8 +527,9 @@ MakePointSourceMask(G3SkyMapConstPtr map, const std::vector & ra, } -namespace bp = boost::python; -void maputils_pybindings(void){ +PYBINDINGS("maps") +{ + namespace bp = boost::python; bp::def("remove_weights_t", RemoveWeightsT, (bp::arg("T"), bp::arg("W"), bp::arg("zero_nans")=false), "Remove weights from unpolarized maps. If zero_nans is true, empty pixels " diff --git a/maps/src/python.cxx b/maps/src/python.cxx index 1c13e842..f2c7db77 100644 --- a/maps/src/python.cxx +++ b/maps/src/python.cxx @@ -1,5 +1,4 @@ #include -#include namespace bp = boost::python; @@ -7,7 +6,6 @@ BOOST_PYTHON_MODULE(maps) { bp::import("spt3g.core"); bp::docstring_options docopts(true, true, false); - maputils_pybindings(); G3ModuleRegistrator::CallRegistrarsFor("maps"); }