Skip to content

Signal whether group-averaging happened (Collection.is_grouped / meta.grouped) #790

Description

@jepegit

Problem

collect_summaries(..., group_it=True) silently returns a wide, non-averaged
frame when any group has < 2 cells (the "std needs ≥ 2 cells" guard in
cellpy/collect/summary.py). That fallback is sensible, but the returned
Collection carries no flag telling the caller whether averaging actually happened.

In the app I have to sniff for a mean column to know how to label/plot the result:

def is_grouped(collection) -> bool:
    return "mean" in collection.data.columns

Suggestion

Expose it explicitly, e.g. Collection.meta.grouped: bool (or Collection.is_grouped),
set by collect_summaries when it actually averages. Then apps can adapt the UI /
axis labels / spread option without inspecting columns.


Found while building cellpy-simple-gui on cellpy 2.1.0.post1. Full write-up with all items: CELLPY_PAINPOINTS.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementv2cellpy v2 work - PRs should target the master branch

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions