uob-positron-imaging-centre / up4

Post-processor for particle data.
https://uob-positron-imaging-centre.github.io/up4/
GNU General Public License v3.0
9 stars 1 forks source link

Issue with 2D scalar field - offset #29

Closed WJPeace1 closed 1 year ago

WJPeace1 commented 1 year ago

new_667_200mm_vel_cs_xy_plane 667_200mm_vel_cs_xy_plane

The latest update of the software has had an issue where the scalar fields have become offset. Image 1 is a new plot, image 2 is the old plot - both of scalar velocity in the XY plane. The data seems to be offset in both of the axes. Furthermore, the data seems to show different colours at some cells - perhaps indicating a change in the way velocity has been calculated?

dwerner95 commented 1 year ago

can you attach the code that you used to produce that plot please?

WJPeace1 commented 1 year ago

can you attach the code that you used to produce that plot please?

grid = up4.Grid.cartesian3d_from_data(data, cells = [25 ,25,25])

field = data.velocityfield(grid)

xpos,ypos,zpos = field.cell_positions()
fig.add_trace(go.Heatmap(z = avg_field_ax0))

fig.update_layout(
    xaxis = dict(
        tickmode = 'array',
        tickvals = [0,int(cx/4),int(cx/2),int((3*cx)/4),int(cx-1)],
        ticktext = ["<b> -1 </b>", "<b> -0.5 </b>","<b> 0 </b> ", "<b> 0.5 </b> ","<b> 1 </b>"],
    ),
    yaxis = dict(
        tickmode = 'array',
        tickvals = [0,int(cx/4),int(cx/2),int((3*cx)/4),int(cx-1)],
        ticktext = ["<b> 0 </b>", "<b> 0.25 </b>","<b> 0.5 </b> ", "<b> 0.75 </b> ","<b> 1 </b>"],
    ),
)

fig.show()
dwerner95 commented 1 year ago

Yes i see, there is an issue with commit 2325961. The cell_id function in the cartesian grid is wrong. I am working on this. Should be a quick fix.

dwerner95 commented 1 year ago

Commit 95cb65f should have fixed it. can you try and tell me?

dwerner95 commented 1 year ago

Talked to will- issue is fixed