Behavior of import_file("*.xyz") when using a pipeline

When loading a bunch of files into ovito-python by ‘import_file’, it’s possible to see the number of data files imported:

pipeline = import_file("...")
nframes = pipeline.source.num_frames

When using this pipeline within the loop over the ‘num_frames’, how can I know which specific file will be processed in each loop iteration. What I need is something like

for id in range(1,nframes+1):
    filename = pipeline.source.filename[id] # <-- hypothetical code

How can I achieve this?

Thanks!

Take a look at the available data attributes: gui, python.

Hi, Thank you. I found it:

for data in pipeline.frames:
    fn = data.attributes['SourceFile']
    sf = data.attributes['SourceFrame']
    print("Frame {:d} of {:d} ({:s})".format(sf, nframes, fn))

Does everything I need. But had to look for a while :wink: