Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

world material u_s leads to infinite time IPP. #112

Open
PyMarc2 opened this issue Feb 11, 2024 · 0 comments · May be fixed by #122
Open

world material u_s leads to infinite time IPP. #112

PyMarc2 opened this issue Feb 11, 2024 · 0 comments · May be fixed by #122
Assignees

Comments

@PyMarc2
Copy link
Contributor

PyMarc2 commented Feb 11, 2024

Problem
IPP (Interaction per Photon) Estimation is infinite if the world medium does not have a minimal mu_a when there is a mu_s.
Either an error message should be displayed to add a mu_aif there is an error, or a timeout should be applied.

Reproduction

from pytissueoptics import *

def exampleCode():
    N = 100000 if hardwareAccelerationIsAvailable() else 1000
    absorptionlayer = Cuboid(1,1,0.1, position=Vector(0,0,0.2), material=ScatteringMaterial(mu_s=0, mu_a=0.1, g=1, n=1.01))
    scene = ScatteringScene([absorptionlayer], worldMaterial=ScatteringMaterial(mu_s=100, mu_a=0, g=0.9, n=1.0))
    logger = EnergyLogger(scene)
    source = PencilPointSource(position=Vector(0, 0, 0), direction=Vector(0, 0, 1), N=N)

    scene.show(source=source)
    source.propagate(scene, logger=logger)

    viewer = Viewer(scene, source, logger)
    viewer.reportStats()

    viewer.show2D(View2DProjectionX(binSize=0.001))
    viewer.show2D(View2DSurfaceZ(solidLabel="cuboid", surfaceLabel="cuboid_front"))
    viewer.show2D(View2DSurfaceZ(solidLabel="cuboid", surfaceLabel="cuboid_front"))
    viewer.show3D()

if __name__ == "__main__":
    exampleCode()

Expected behavior

2 potential solutions:

  • Have boundaries set around the scene by default
  • Tell the user that mu_a must not be 0 if the world medium has mu_s != 0.

** System Information**

  • OS: Windows 11
  • Python 3.11
@JLBegin JLBegin self-assigned this Aug 12, 2024
@JLBegin JLBegin linked a pull request Aug 12, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants