2 #include "boost/format.hpp" 4 #include "lsst/meas/extensions/psfex/psf.hh" 7 #define RETURN_IMAGE_FIELD(NAME, CNAME, SIZE) \ 8 ndarray::Array<float,2,2> \ 11 ndarray::Array<float,2,2>::Index shape = ndarray::makeVector(SIZE[0], SIZE[1]); \ 12 ndarray::Array<float,2,2>::Index strides = ndarray::makeVector(1, SIZE[0]); \ 14 return ndarray::external(impl->CNAME, shape, strides); \ 17 namespace lsst {
namespace meas {
namespace extensions {
namespace psfex {
30 for (
int i = 0; i !=
ndim; ++i) {
31 cnames[i] = names[i].c_str();
34 impl = context_init(const_cast<char **>(&cnames[0]),
35 const_cast<int *>(&group[0]),
37 const_cast<int *>(°ree[0]),
38 ngroup, (pcexflag ? 1 : 0));
39 _pc_vectors.resize(impl->npc);
48 if (i < 0 || i >= impl->npc) {
50 s1 <<
"Index " << i <<
" is out of range 0.." << impl->npc - 1;
53 if (_pc_vectors[i].empty()) {
54 _pc_vectors[i].reserve(impl->npc);
55 for (
int j = 0; j != impl->npc; ++j) {
56 _pc_vectors[i][j] = impl->pc[i*impl->npc + j];
59 return _pc_vectors[i];
64 void Sample::setVig(ndarray::Array<float,2,2>
const& img)
66 int const w = img.getSize<0>(), h = img.getSize<1>();
68 if (_vigsize[0]*_vigsize[1] != w*h) {
71 % _vigsize[0] % _vigsize[1] % w % h));
74 ndarray::Array<float,1,1> flattened = ndarray::flatten<1>(img);
75 std::copy(flattened.begin(), flattened.end(), impl->vig);
85 Set::Set(Context &c) {
86 impl = init_set(c.impl);
87 impl->nsample = impl->nsamplemax = 0;
96 if (impl->nsample >= impl->nsamplemax) {
97 if (impl->nsamplemax == 0) {
98 malloc_samples(impl, LSAMPLE_DEFSIZE);
100 realloc_samples(impl, (
int)(1.62*impl->nsamplemax + 1));
103 return Sample(impl->sample[impl->nsample], _recentroid, impl->vigsize);
107 Set::trimMemory()
const 109 setstruct *mutable_impl =
const_cast<setstruct *
>(impl);
110 realloc_samples(mutable_impl, impl->nsample);
114 Set::finiSample(Sample
const& sample)
117 make_weights(impl, sample.impl);
118 if (sample._recentroid) {
119 recenter_sample(sample.impl, impl, sample._fluxrad);
126 #if 0 // we don't own impl 132 Psf::build(
double x,
double y,
135 if (!impl->contextoffset) {
136 throw std::out_of_range(
"psf.contextoffset not set (probably no valid stars) so I can't index it");
140 pos[0] =
x; pos[1] =
y;
144 for (
unsigned int i = 0; i != pos.
size(); ++i) {
145 pos[i] = (pos[i] - impl->contextoffset[i])/impl->contextscale[i];
148 psf_build(impl, &pos[0]);
Reports attempts to exceed implementation-defined length limits for some classes. ...
#define RETURN_IMAGE_FIELD(NAME, CNAME, SIZE)
A base class for image defects.
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
table::Key< table::Array< int > > degree
table::Key< table::Array< int > > group
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
ItemVariant const * other