# TypeError: 'tuple' object is not callable in FLAC3D Python Script

**URL:** <https://forum.itascainternational.com/t/typeerror-tuple-object-is-not-callable-in-flac3d-python-script/1982>\
**Category:** FLAC3D\
**Tags:** python\
**Created:** [March 11, 2025, 5:18am UTC](https://forum.itascainternational.com/t/typeerror-tuple-object-is-not-callable-in-flac3d-python-script/1982 "2025-03-11T05:18:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mahdi.S](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@Mahdi.S](https://forum.itascainternational.com/u/Mahdi.S)\
**Post date:** [March 11, 2025, 5:18am UTC](https://forum.itascainternational.com/t/typeerror-tuple-object-is-not-callable-in-flac3d-python-script/1982/1 "2025-03-11T05:18:51Z")

</div>

Hi Everyone,

I am using the following Python code snippet in FLAC3D, which is taken from the documentation. However, I am encountering the following error:

> Traceback (most recent call last):  
> File “‘’”, line 24, in   
> TypeError: ‘tuple’ object is not callable

Here is the code:

> import functools  
> import numpy as np  
> np.set\_printoptions(threshold=20)  
> import itasca as it  
> from itasca import zonearray as za  
> from itasca import gridpointarray as gpa  
> it.command(“”"  
> model new  
> model large-strain off  
> zone create brick size 10 10 10  
> zone cmodel assign elastic  
> zone property density 2950 young 12e9 poisson 0.25  
> cycle 1  
> “”")  
> za.pos()  
> p = za.pos()  
> x,y,z = p.T  
> from functools import reduce  
> corner\_mask = reduce(np.logical\_and, (x\<3, y\<3, z\<3))  
> za.set\_group(corner\_mask, “corner”, “geometry”)

I believe the error might be related to how `corner_mask` is being passed to `za.set_group()`, but I am unsure of the exact issue.

Could anyone please help me understand the cause of this error and suggest a solution?

Thank you in advance for your help! 😊

---

<div class="post-metadata">

**Author:** ![cheng](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@cheng](https://forum.itascainternational.com/u/cheng)\
**Post date:** [March 11, 2025, 9:45pm UTC](https://forum.itascainternational.com/t/typeerror-tuple-object-is-not-callable-in-flac3d-python-script/1982/2 "2025-03-11T21:45:44Z")

</div>

Which version are you using?  
If v9.0 or older, the command “python-reset-state false” is required:

> …  
> import itasca as it  
> it.command(“python-reset-state false”)  
> …

---

<div class="post-metadata">

**Author:** ![Mahdi.S](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@Mahdi.S](https://forum.itascainternational.com/u/Mahdi.S)\
**Post date:** [March 11, 2025, 10:03pm UTC](https://forum.itascainternational.com/t/typeerror-tuple-object-is-not-callable-in-flac3d-python-script/1982/3 "2025-03-11T22:03:31Z")

</div>

Thank you for your reply.  
I have used the `python-reset-state false` command, but I am still facing the same error.  
I am using v9.00.177

---

<div class="post-metadata">

**Author:** ![Theophile](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.itascainternational.com/theophile/32/299_2.png) [@Theophile](https://forum.itascainternational.com/u/Theophile)\
**Post date:** [March 13, 2025, 3:17pm UTC](https://forum.itascainternational.com/t/typeerror-tuple-object-is-not-callable-in-flac3d-python-script/1982/4 "2025-03-13T15:17:44Z")

</div>

Hi there,

Using Flac3D6, I could not reproduce the error.  
This seems to be a pure Python one, what version of Python and numpy are you using?

Did you have any chance executing line-per-line your script in Flac3D ipython console?

By the way, just a couple of NumPy tips: boolean arrays support the `&` operator, your `reduce(np.logical_and, ...)` can be written as `corner_mask = (x<3) & (y<3) & (z<3)`.  
If you like it even shorter, you can get the same result with `corner_mask = (p<3).all(axis=1)`:

- `(p<3)` is a `(Nzones,3)`-array where first, second and third columns correspond to `x<3`, `y<3` and `z<3`, respectively
- `(p<3).all(axis=1)` is a `Nzones`-array and ensures that all three values in each row are `True`

Cheers!

Theophile

---

<div class="post-metadata">

**Author:** ![Mahdi.S](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@Mahdi.S](https://forum.itascainternational.com/u/Mahdi.S)\
**Post date:** [March 17, 2025, 10:38pm UTC](https://forum.itascainternational.com/t/typeerror-tuple-object-is-not-callable-in-flac3d-python-script/1982/5 "2025-03-17T22:38:12Z")

</div>

Thank you, Theophile.  
I ran the code on another machine, and it worked!  
Maybe there is an issue with the Python configuration on that machine.
