Selectively delete SOP points based on data from a TOP

Hey all, does anyone know how to use a top to selectively delete points on a grid of points?

I have a 5px by 5px top that’s quantized to have values between 0-1 with steps of 0.125 that matches to a grid of points. I’d like to delete all the points where the matching pixel value isn’t 0.125 (or some other arbitrary value).

My hunch is that I convert the top to a chop, then using the Filter Expression in a Delete sop, using the number of the point, look up the corresponding sample in the topToChop and if the corresponding value isn’t equal to an arbitrary number, return true, else return false.

The problem is, I have no idea what should go in the filter expression field, and I can’t find any documentation / examples of people using it. Obviously python or tscript, but is the number for the point available to use in that field?

I just realized this approach for selectively deleting instances is inherently flawed, by using a script SOP to do what I was talking about above, the other TOPS feeding the scale and rotation of the instances have a different number of points than the SOP feeding the position, which causes an error

I figured out a better way of doing this than what I was going at.

I’m trying to selectivly “delete” instances depending on what the value of the blue channel in a noise top.

You can use a Delete CHOP to delete individual samples in channel based on some arbitrary logic. If other channels are passed into that delete CHOP, it will also delete samples with the same index from the other channels. So you convert the Grid SOP and Noise TOP into channels, merge them together, then pass them into the Delete CHOP, and because the Delete CHOP deletes the same index samples from each channel, the Geo is happy since all the input channels have the same number samples.
SelectivlyDeleteInstances.toe (4.6 KB)