Forum Navigation
You need to log in to create posts and topics.

overlay spatial binning

Hi,

I am trying to overlay a spatial binning plot to the render ports but i haven't been able to access the data. I know it is a data series but I don't know how to access to plot it. Help would be greatly appreciated. I could use a scatter plot also, but still I don't know how to access the data. Sorry for the probably silly question.

Thanks,

Enrique

Hi Enrique,

Not a silly question at all. The scripting documentation is still very scarce when it comes to data series and how to access their data. I still got to write the documentation.

In the meantime, let me give you a code snippet demonstrating what you need to do:

# Evaluate the data pipeline containing the spatial binning modifier:
data = pipeline.compute()
    
# Print the list of available data series keys in case you don't know 
# the key of the data series you are looking for. 
print(list(data.series.keys()))

# Look up the data series you are interested in:
series = data.series['binning[Centrosymmetry]']

# Turn the DataSeries object into a Nx2 numpy array containing the x-y data points:
xy_data = series.as_table()

Let me know if you have any further questions.

-Alex

Hi Alex,

 

Thanks a lot! The print statement is the key, I think.

Now, I want to make a movie with the plot showing each frame. As is , it is plotting always the same frame. Is there a way to do this?

Thanks again! Ovito is a great tool!

Enrique

Make sure you pass the current animation frame to the Pipeline.compute() method; otherwise it will evaluate the data pipeline at frame 0 by default. For example:

def render(args):
    pipeline = args.scene.selected_pipeline
    data = pipeline.compute(args.frame)
    ...

 

There we go!

Fantastic Alex, thanks a lot!

Enrique

新的OVITO微信频道!
New for our users in China: OVITO on WeChat 

Official OVITO WeChat channel operated by Foshan Diesi Technology Co., Ltd.