diff --git a/src/elisa/data/ogip.py b/src/elisa/data/ogip.py index 6d9c7d4c..8ca7e9a0 100644 --- a/src/elisa/data/ogip.py +++ b/src/elisa/data/ogip.py @@ -54,18 +54,21 @@ class Data: available so that each channel group has: * ``'const'``: `scale` number channels - * ``'min'``: counts >= `scale` for src + bkg - * ``'sig'``: src significance >= `scale`-sigma + * ``'min'``: total (source + background) counts >= `scale` + * ``'sig'``: source significance >= `scale` sigma * ``'opt'``: optimal binning, see Kaastra & Bleeker (2016) [3]_ - * ``'optmin'``: opt with counts >= `scale` for src + bkg - * ``'optsig'``: opt with src significance >= `scale`-sigma - * ``'bmin'``: counts >= `scale` for bkg, useful for ``wstat`` - * ``'bpos'``: bkg < 0 with probability < `scale`, useful for - ``pgstat`` + * ``'optmin'``: optimal binning with total counts >= `scale` + * ``'optsig'``: optimal binning with source significance >= `scale` + sigma + * ``'bmin'``: background counts >= `scale`, used to avoid bias when + using ``wstat`` to simultaneously fit the source and background + * ``'bpos'``: background counts < 0 with probability < `scale`, + used to avoid bias when using ``pgstat`` to simultaneously fit + the source and background The default is None. scale : float or None, optional - Grouping scale. Only takes effect if `group` is not None. + Grouping scale for the method specified in `group`. spec_poisson : bool or None, optional Whether the spectrum data follows counting statistics, reading from the `specfile` header. This value must be set if ``POISSERR`` is @@ -288,14 +291,17 @@ def group(self, method: str, scale: float | int): are available so that each channel group has: * ``'const'``: `scale` number channels - * ``'min'``: counts >= `scale` for src + bkg - * ``'sig'``: src significance >= `scale`-sigma - * ``'opt'``: optimal binning, see Kaastra & Bleeker (2016) [1]_ - * ``'optmin'``: opt with counts >= `scale` for src + bkg - * ``'optsig'``: opt with src significance >= `scale`-sigma - * ``'bmin'``: counts >= `scale` for bkg (useful for ``wstat``) - * ``'bpos'``: bkg < 0 with probability < `scale`, useful for - ``pgstat`` + * ``'min'``: total (source + background) counts >= `scale` + * ``'sig'``: source significance >= `scale` sigma + * ``'opt'``: optimal binning, see Kaastra & Bleeker (2016) [3]_ + * ``'optmin'``: optimal binning with total counts >= `scale` + * ``'optsig'``: optimal binning with source significance >= `scale` + sigma + * ``'bmin'``: background counts >= `scale`, used to avoid bias when + using ``wstat`` to simultaneously fit the source and background + * ``'bpos'``: background counts < 0 with probability < `scale`, + used to avoid bias when using ``pgstat`` to simultaneously fit + the source and background scale : float Grouping scale. diff --git a/src/elisa/util/misc.py b/src/elisa/util/misc.py index 02d932e6..c37480e3 100644 --- a/src/elisa/util/misc.py +++ b/src/elisa/util/misc.py @@ -200,49 +200,6 @@ def make_pretty_table(fields: Sequence[str], rows: Sequence) -> PrettyTable: return table -# def ordered_composition( -# basic_mapping: Sequence[ParamID], -# composite_mapping: dict[ParamID, Sequence[ParamID]], -# ) -> tuple[ParamID, ...]: -# """Get ordered composition. -# -# Parameters -# ---------- -# basic_mapping : sequence -# Sequence of basic parameter id. -# composite_mapping : dict -# Mapping of composite parameter id to sequence of parameter id, which -# may include id existing in `composite_mapping`. -# -# Returns -# ------- -# ordered : tuple -# Ordered keys of `composite_mapping`. -# -# """ -# nodes = set(i for pids in composite_mapping.values() for i in pids) -# available_nodes = set(basic_mapping) | set(composite_mapping) -# if nodes - available_nodes != set(): -# raise ValueError( -# '`composition` id must be a subset of union of `basic_mapping` ' -# 'and `composition`' -# ) -# -# ordered = list(basic_mapping) -# remains = dict(composite_mapping) -# while remains: -# to_del = [] -# for k, v in remains: -# if all(pid in ordered for pid in v): -# to_del.append(k) -# ordered.append(k) -# -# for k in to_del: -# del remains[k] -# -# return tuple(k for k in ordered if k not in basic_mapping) - - def replace_string(value: T, mapping: dict[str, str]) -> T: """Replace all strings in `value` appeared in `mapping`.