Skip to content

Commit

Permalink
Refactor tools.x2y
Browse files Browse the repository at this point in the history
Updates to commenting.
  • Loading branch information
tsipkens committed Apr 24, 2021
1 parent d50c9ca commit 162a46e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions +tools/x2y.m
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
n_dim = grid_x.ne(dim); % number of elements for DIM of grid_x
y = zeros(grid_x.ne(dim), length(y_n)); % intialize transforms distribution

for ii=1:n_dim
for ii = 1:n_dim

% Initialize transformation kernel of appropriate size.
T = zeros(grid_y.ne(dim2), grid_x.ne(dim2));
Expand All @@ -123,15 +123,15 @@
end

% Take logarithm.
y_old = max(y_old, 0);
y_old = max(y_old, 0); % remove negative entries (not allowed on log grid)
y_old = log10(y_old);

% Loop over masses computing overlap between new and old elements.
for jj=1:grid_x.ne(dim2)
for jj = 1:grid_x.ne(dim2)
T(:,jj) = max(...
min(log10(grid_y.nodes{dim2}(2:end)), y_old(jj+1)) - ... % upper bound
max(log10(grid_y.nodes{dim2}(1:(end-1))), y_old(jj))... % lower bound
,0) ./ ...
max(log10(grid_y.nodes{dim2}(1:(end-1))), y_old(jj)) ... % lower bound
, 0) ./ ...
(log10(grid_y.nodes{dim2}(2:end)) - ...
log10(grid_y.nodes{dim2}(1:(end-1)))); % normalize by y bin size
end
Expand Down
2 changes: 1 addition & 1 deletion main_bayes_sp2.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
grid_t = Grid(span_t,...
[540,540],'logarithmic');
grid_t = grid_t.partial(0,1);
phantom = Phantom('distr-sp2',grid_t);
phantom = Phantom('distr-sp2-2', grid_t);
x_t = phantom.x;
nmax = max(x_t);
cmax = nmax;
Expand Down

0 comments on commit 162a46e

Please sign in to comment.