Algorithm "Max Modulation" was not yet exposed in the Python API
-
Additionally, my boundary is set to 1V, and I want to normalize it to 1mA. In the GUI, I need to model a box to calculate the scale factor, but it is a bit cumbersome to create a box in the script to cover each electrode. Is there a better way to quickly normalize it?
-
Regarding normalizing the field between the electrode, you could use the current extractor tool.
- After running your simulation in the Analysis Tab, select the simulation and extract the "Overall Field"
- Select the overall field, click on the "Field Data Tools" in the ribbon, and select "Current Extractor". This output gives the current in the system in units of Amps.
- Select the "Overall Field" and in the Controller select "EM E(x,y,z,f0)". Following this click on "Field Data Tools" in the ribbon again. Select "Field Scaling" now.
- Change the scale factor in the controller window based on the following formula (1/Flux*1000) since you want it to be normalized to 1mA. Use the current value you have extracted for the following calculation.
- Click Refresh.
- Then select the scaled electric field and use the slice viewer to plot it.
Attached is the code below
temp-35.py -
@halder I ran your code and encountered the following error: Traceback (most recent call last):
File "F:\Huilin\sim4life_pro\script\head_segment.py", line 826, in <module>
comp1 = output1.Data.GetComponent(0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Could not allocate memory for numpy array.
Traceback (most recent call last):
File "F:\Huilin\sim4life_pro\script\head_segment.py", line 875, in <module>
raise(exc)
File "F:\Huilin\sim4life_pro\script\head_segment.py", line 826, in <module>
comp1 = output1.Data.GetComponent(0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Could not allocate memory for numpy array.My memory is 256GB, and I checked the Task Manager and found that not much memory was being used. So I ran it two more times, and the third time it succeeded, but I received a warning:
Analysis : [Warn] Found 451673 NaN (not a number) values (81.96 -
The current extractor essentially calculates the current between two electrodes by integrating the current density field through a closed surface (defined as an isopotential surface surrounding one electrode -the user can use the default isopotential value or customize it, this will affect this number of NaNs). To access these parameters as part of your code use the following:
current_extractor.IsoSurfacePerCentThreshold = Enter Value
current_extractor.SurfaceRefinement = Enter Value -
@halder thank you for the explanation and laying out the steps for scaling the field. I'm also trying to normalize my current to 1mA in my simulations. However, I'm running an older version of sim4life, v6.2. Is this "Current Extractor" tool only available in newer versions of the software? Are there any concerns with backwards compatibility of previous models if I were to update to the current version of sim4life?
I was following the steps on an old post and using the "Total Flux" to evaluate my currents. Would an equivalent method to the "Current Extractor" tool be to evaluate "Total Flux" for the Absolute Value of J field on the surface of my boundary condition? Thanks in advance