/************************************************************************\ * This subroutine modifies the centroid of the truncation function. * * There is a complicated scheme to assign the centroid to the * * truncation function because it may have its own centroid, or it may * * take on the centroid of the object that it is modifying. And * * because multiple objects are allowed to use the same truncation * * function, the centroids may all be different even though all the * * remaining parameters are shared by all the profile functions. * * * * This is normally not such a big issue except when a PSF is * * oversampled: the centroids have to be shifted/expanded relative to * * the main galaxy profile component. * \************************************************************************/ #include #include "structs.h" int istrunc (char *objtype); void trunc_cent (struct fitpars *mod, struct fitpars *orig, float *refpos, int os) { struct fitpars *new_trunc, *orig_tr; orig_tr = orig->high; /* Point to the original fpar->high structure */ /* to look for truncation funcstions. */ new_trunc = mod->high; /* Point to the temporary fpar->high structure */ /* created to store parameters modified for */ /* oversampling and convolution. */ while (new_trunc != NULL) { if (istrunc (new_trunc->objtype)) { /*-------------------------------------------------------------\ | If the truncation function doesn't have its own position, | | then it is centered on the function it's truncating by | | setting ia = 3. Note that this is set only in the copy | | of fpar, not in the original fpar. If it's set in the | | original fpar, then df work arrays would be created for | | these components, which is bad news. | \-------------------------------------------------------------*/ if (orig_tr->ia[1] == -1 || orig_tr->ia[2] == -1) { new_trunc->a[1] = refpos[1]; new_trunc->a[2] = refpos[2]; new_trunc->ia[1] = 3; new_trunc->ia[2] = 3; }; /*-------------------------------------------------------------\ | If the truncation function has its own position, then all | | we have to do is figure out how it relates to the model | | function it is truncating. | \-------------------------------------------------------------*/ if (orig_tr->ia[1] >= 0 || orig_tr->ia[2] >= 0) { new_trunc->a[1] = (orig_tr->a[1] - orig->a[1]) * os + refpos[1]; new_trunc->a[2] = (orig_tr->a[2] - orig->a[2]) * os + refpos[2]; }; }; orig_tr = orig_tr->next; new_trunc = new_trunc->next; }; }