from pytissueoptics import *
# Define (scene, source, logger)
N = 500_000
scene = samples.PhantomTissue()
source = DivergentSource(
position=Vector(0, 0, -0.1), direction=Vector(0, 0, 1), N=N, diameter=0.2, divergence=0.78
)
logger = EnergyLogger(scene)
# Run
source.propagate(scene, logger=logger)
# Stats & Visualizations
viewer = Viewer(scene, source, logger)
viewer.reportStats()
viewer.show2D(View2DProjectionX())
viewer.show2D(View2DProjectionX(solidLabel="middleLayer"))
viewer.show2D(View2DSurfaceZ(solidLabel="middleLayer", surfaceLabel="interface0"))
viewer.show1D(Direction.Z_POS)
viewer.show3D()
It was expected to give every plot of the results, but only gave the 2D plots.
PS C:\Users\mrafa\Desktop\Universidade\Disciplinas\3ºano-2ºsem\Projeto final\Codigo> & C:\Users\mrafa\AppData\Local\Programs\Python\Python313\python.exe "c:/Users/mrafa/Desktop/Universidade/Disciplinas/3ºano-2ºsem/Projeto final/Codigo/Tests/example1.py"
Propagating 500000 photons with hardware acceleration on device Intel(R) Iris(R) Xe Graphics...
=============================== SIMULATION PROGRESS ===============================
[BATCH #] :: [PHOTON COUNT] :: [SPEED (ph/ms)] :: [TIME ELAPSED] :: [TIME LEFT]
Non-empty compiler output encountered. Set the environment variable PYOPENCL_COMPILER_OUTPUT=1 to see more.
1 :: 82833 (16.6%) :: 288.60 :: 0.29 s :: 1.45 s
2 :: 174983 (35.0%) :: 356.28 :: 0.49 s :: 0.91 s
3 :: 268857 (53.8%) :: 385.67 :: 0.70 s :: 0.60 s
4 :: 362856 (72.6%) :: 391.53 :: 0.93 s :: 0.35 s
5 :: 464309 (92.9%) :: 412.37 :: 1.13 s :: 0.09 s
6 :: 497077 (99.4%) :: 383.64 :: 1.30 s :: 0.01 s
7 :: 500000 (100.0%) :: 348.20 :: 1.44 s :: 0.00 s
Computation splits:
Propagation: 29.6%
Data transfer: 16.2%
Data conversion: 46.4%
==================================================================================
Report of solid 'frontLayer'
Absorbance: 60.82% (59.91% of total power)
Absorbance + Transmittance: 100.0%
Transmittance at 'frontLayer_front': 1.3%
Transmittance at 'frontLayer_left': 0.2%
Transmittance at 'frontLayer_right': 0.2%
Transmittance at 'frontLayer_bottom': 0.2%
Transmittance at 'frontLayer_top': 0.2%
Transmittance at 'interface1': 37.0%
Report of solid 'backLayer'
Absorbance: 86.68% (13.44% of total power)
Absorbance + Transmittance: 100.0%
Transmittance at 'backLayer_back': 9.5%
Transmittance at 'backLayer_left': 0.4%
Transmittance at 'backLayer_right': 0.4%
Transmittance at 'backLayer_bottom': 0.4%
Transmittance at 'backLayer_top': 0.4%
Transmittance at 'interface0': 2.2%
Report of solid 'middleLayer'
Absorbance: 53.03% (19.49% of total power)
Absorbance + Transmittance: 100.0%
Transmittance at 'middleLayer_left': 0.3%
Transmittance at 'middleLayer_right': 0.3%
Transmittance at 'middleLayer_bottom': 0.3%
Transmittance at 'middleLayer_top': 0.3%
Transmittance at 'interface0': 42.2%
Transmittance at 'interface1': 3.5%
Mayavi is not available. Falling back to a null 3D viewer. Fix the following error to use the Mayavi backend or select another backend by setting the PTO_3D_BACKEND environment variable (available backends: ('mayavi', 'null')).
module 'numpy' has no attribute 'in1d'
Traceback (most recent call last):
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\pytissueoptics\scene\viewer\provider.py", line 13, in get3DViewer
from .mayavi.mayavi3DViewer import Mayavi3DViewer
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\pytissueoptics\scene\viewer\mayavi\mayavi3DViewer.py", line 2, in <module>
from mayavi import mlab
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\mayavi\mlab.py", line 16, in <module>
from mayavi.tools.camera import view, roll, yaw, pitch, move
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\mayavi\tools\camera.py", line 24, in <module>
from .engine_manager import get_engine
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\mayavi\tools\engine_manager.py", line 14, in <module>
from mayavi.core.registry import registry
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\mayavi\core\registry.py", line 16, in <module>
from mayavi.core.metadata import Metadata, import_symbol
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\mayavi\core\metadata.py", line 11, in <module>
from mayavi.core.pipeline_info import PipelineInfo
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\mayavi\core\pipeline_info.py", line 12, in <module>
from .utils import get_tvtk_dataset_name
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\mayavi\core\utils.py", line 4, in <module>
from vtk.numpy_interface import algorithms as algs
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\vtkmodules\numpy_interface\algorithms.py", line 984, in <module>
in1d = _make_ufunc(numpy.in1d)
^^^^^^^^^^
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\numpy\__init__.py", line 805, in __getattr__
raise AttributeError(f"module {__name__!r} has no attribute {attr!r}")
AttributeError: module 'numpy' has no attribute 'in1d'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Users\mrafa\Desktop\Universidade\Disciplinas\3ºano-2ºsem\Projeto final\Codigo\Tests\example1.py", line 22, in <module>
viewer.show3D()
~~~~~~~~~~~~~^^
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\pytissueoptics\rayscattering\display\viewer.py", line 123, in show3D
self._viewer3D = get3DViewer()
~~~~~~~~~~~^^
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\pytissueoptics\scene\viewer\provider.py", line 22, in get3DViewer
from .null3DViewer import Null3DViewer
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\pytissueoptics\scene\viewer\null3DViewer.py", line 4, in <module>
from scene.solids import Solid
ModuleNotFoundError: No module named 'scene'
PS C:\Users\mrafa\Desktop\Universidade\Disciplinas\3ºano-2ºsem\Projeto final\Codigo>
Description of the bugs
There are two problems with the PyTissueOptics package in this moment:
To Reproduce
Just run the given example on the webpage https://pypi.org/project/pytissueoptics/ :
Expected behavior
It was expected to give every plot of the results, but only gave the 2D plots.
Screenshots
Desktop
Packages versions
Output of the running program