Skip to content

Q/FR: transpose method for Labelset? (tobuffer-related) #343

@balintlaczko

Description

@balintlaczko

Hi!

I am implementing a faster dataset loading for the fluid.jit.plotter Max abstraction based on the new tobuffer label-flipping flag (that was also my FR, thanks for adding!). However, I now realized that I actually need both labelsets: sometime I need to look up a buffer sample index to get the corresponding dataset ID, and sometimes the other way around.

Since there is AFAIK no way to render two labelsets (ids2samples and samples2ids), I thought I could run two tobuffer requests, and render both labelsets this way. Looking at the source here, to my (limited, LLM-influenced) understanding, the mapping between buffer frame indices and dataset IDs should be the same both ways, since a deterministic sequence is generated with seq.generate(indices); before either type of Labelset is returned. (Right?!) So far so good.

But now I see that this is inefficient, since, to get both mapping directions, now I also have to generate the buffer twice. So, I wonder if there is (or could be) a way to transpose a labelset (in place or into another)? I realize the issue that, apart from the tobuffer scenario, the labels may not be unique, which would "complicate" this.

Alternatively, do you have an advice for me to get both labelsets without

  • generating the buffer twice,
  • needing a for-loop to generate the opposite direction table,
  • needing to use the dump method?

Thanks for any feedback!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions