Help with Threshold filter

Hello I am trying to script a headless version of a process that I am using through the gui for school and I am running into a bit of an issue with the threshold fitler. I am using a Programmable Filter (to subtract 2 sets of table to points data from each other) > Applying a glyph (Sphere for visual) > and Applying threshold to the glyph (to filter my results based on positive or negative change recorded)

When used in the gui I am able to do these 3 steps then set my minimum and maximum threshold values from -1:1 and click apply where the renderview updates and I see all of my spheres.

The issue I’m running into when scripting is that all of my commands are working but the minimum and maximum for the threshold are not sticking. I have a portion in the script that sets -1 to lower bound and 1 for upper bound but when the render loads the threshold values have been been automatically set from 0:0. This is causing only ~20% of my data to render at start whereas if I go through my manual method in the gui I can start with 100% of data and work backwards. I’ve tried adding in several spots to update pipeline as a way to force the apply button but have seen no change. I’ll upload the snip of script for threshold as well as a screen capture for the expected gui view vs actual. The parts commented out in the code snip are things I attempted but did not have luck with in changing.

print(“Applying Threshold filter…”)
#diff_glyph.UpdatePipeline()
threshold = Threshold(Input=diff_glyph)
#threshold.UpdatePipeline()
threshold.Scalars = \[‘POINTS’, ‘CSV Difference’\]  # Replace with actual difference column name
threshold.LowerThreshold = -1
threshold.UpperThreshold = 1
threshold.AllScalars = 1  # Use all scalars mode
#threshold.ThresholdMethod = “Between”

threshold.UpdatePipeline()
Render()

Which version of ParaView are you using ? You may want to update.

I’m using paraview 6.0.1, was this a known bug in an older version?

hum, thats strange, my threshold UI is different in ParaView 6.0.1:

Oh gosh I feel dumb, you were absolutely right. I was using paraview 6.0.1 in my spyder instance as I wanted to make sure my script would work but I was checking it in the gui for my paraview 5.5.2 instance. It looks like the threshold that was being made in the new version wasn’t backwards compatible with the older version. As soon as I manually loaded the state into 6.0 the threshold was working as expected. Definitely a user error on my part. Thank you!

1 Like