Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
jzuhone committed Oct 7, 2024
1 parent ab4237f commit 4f696ad
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pyxsim/photon_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,12 @@ def make_photons(
p_size *= 2
d["energy"].resize((p_size,))

if w_field is None:
dx = 0.0
else:
dx = chunk[w_field][idxs].to_value("kpc")
for i, ax in enumerate("xyz"):
pos = chunk[p_fields[i]][idxs].to_value("kpc")
dx = chunk[w_field][idxs].to_value("kpc")
# Fix photon coordinates for regions crossing a periodic boundary
if ds.periodicity[i]:
tfl = pos + dx < le[i]
Expand All @@ -439,9 +442,7 @@ def make_photons(
if w_field is None:
d["dx"][c_offset : c_offset + chunk_nc] = 0.0
else:
d["dx"][c_offset : c_offset + chunk_nc] = chunk[w_field][idxs].to_value(
"kpc"
)
d["dx"][c_offset : c_offset + chunk_nc] = dx

for field in fields_store:
d[field[1]][c_offset : c_offset + chunk_nc] = chunk[field][idxs]
Expand Down

0 comments on commit 4f696ad

Please sign in to comment.