Skip to content

Commit

Permalink
image plane priors for position
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Tessore committed Sep 14, 2015
1 parent 18fbc33 commit 5197a0a
Show file tree
Hide file tree
Showing 7 changed files with 342 additions and 129 deletions.
4 changes: 2 additions & 2 deletions examples/full_mock_nopsf.ini
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ lens.y = unif 48 52
lens.r = unif 15 20
lens.q = unif 0 1
lens.pa = wrap unif 0 180
source.x = unif 45 55
source.y = unif 45 55
source.x = image unif 34 36
source.y = image unif 63 65
source.r = unif 1 5
source.mag = unif -5 0
source.n = unif 0.5 8.0
Expand Down
4 changes: 2 additions & 2 deletions examples/full_mock_psf.ini
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ lens.y = unif 48 52
lens.r = unif 15 20
lens.q = unif 0 1
lens.pa = wrap unif 0 180
source.x = unif 45 55
source.y = unif 45 55
source.x = image unif 34 36
source.y = image unif 63 65
source.r = unif 1 5
source.mag = unif -5 0
source.n = unif 0.5 8.0
Expand Down
6 changes: 4 additions & 2 deletions src/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ void print_input(const input* inp)
print_prior(inp->objs[i].pars[j].pri, buf, 99);

// collect tags
snprintf(tag, 100, " [%s%s%s%s%s%s%s%s",
snprintf(tag, 100, " [%s%s%s%s%s%s%s%s%s",
inp->objs[i].pars[j].type == PAR_POSITION_X ?
"position x, " : "",
inp->objs[i].pars[j].type == PAR_POSITION_Y ?
Expand All @@ -291,7 +291,9 @@ void print_input(const input* inp)
inp->objs[i].pars[j].bounded ?
"bounded, " : "",
inp->objs[i].pars[j].wrap ?
"wrap, " : ""
"wrap, " : "",
inp->objs[i].pars[j].ipp ?
"IPP, " : ""
);

// check if tags were set
Expand Down
3 changes: 3 additions & 0 deletions src/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ typedef struct
// flag for wrap-around parameters
int wrap;

// flag for image plane priors
int ipp;

// label, used for output
const char* label;
} param;
Expand Down
22 changes: 14 additions & 8 deletions src/input/objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ void add_object(input* inp, const char* id, const char* name)
obj->pars[i].upper = param_bounds[i].s[1];
obj->pars[i].pri = NULL;
obj->pars[i].wrap = 0;
obj->pars[i].ipp = 0;
obj->pars[i].label = NULL;
}

Expand Down Expand Up @@ -316,16 +317,21 @@ void set_param_prior(param* par, const char* str)
// free existing prior
free_prior(par->pri);

// get length of first word
len = strcspn(str, WS);

// check for wrap keyword
if(strncmp(str, "wrap", len) == 0)
// parse possible keywords
while(1)
{
// set wrap flag
par->wrap = 1;
// get length of first word
len = strcspn(str, WS);

// check for keywords or break loop
if(strncmp(str, "wrap", len) == 0)
par->wrap = 1;
else if(strncmp(str, "image", len) == 0)
par->ipp = 1;
else
break;

// skip word
// skip word and whitespace
str += len;
str += strspn(str, WS);
}
Expand Down
Loading

0 comments on commit 5197a0a

Please sign in to comment.