signac-dashboard icon indicating copy to clipboard operation
signac-dashboard copied to clipboard

Remove duplicate results when activating multiple `ImageViewer` modules

Open berceanu opened this issue 4 years ago • 4 comments

Feature description

ImageViewer(name="One plot", img_globs=["my_amazing_plot.png"]),
ImageViewer(name="All Plots"),

It would be nice if "my_amazing_plot.png" would not appear twice on the dashboard page.

Proposed solution

Perhaps one one module is activated, it could check the output from the other modules and eliminate the duplicates?

berceanu avatar Feb 07 '21 17:02 berceanu

Hmm. I see your point, but I think I would advocate for users to set specific globs for each ImageViewer module, or only use one with the default setting (all jpg/png/... files). Communicating between modules/cards would require a fair bit of effort and the benefit seems small. Can you help explain why you chose your approach over one of those alternatives?

bdice avatar Feb 07 '21 17:02 bdice

I often have many .pngs as output from postprocessing (>10 / job) and showing them all by default would result in a lot of clutter. So I select a few (2-3) as separate ImageViewer modules and add a general ImageViewer for the rest. Except it's not really the rest, it's the duplicates plus the rest :)

However this is not a big issue, I can definately work around it if the implementation is costly.

berceanu avatar Feb 07 '21 17:02 berceanu

Another alternative would be to change the behavior of img_globs to allow a callable. The callable would act on filenames in the job directory as a filter (True means show, False means hide). This would make it easier to construct a custom set of images that excludes previously shown images.

bdice avatar Feb 07 '21 18:02 bdice

Yes, sounds easier than setting up inter-module communication.

berceanu avatar Feb 07 '21 18:02 berceanu