Skip to content

Commit

Permalink
minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
wcxve committed Mar 13, 2024
1 parent 76db999 commit 52d5b39
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 59 deletions.
38 changes: 22 additions & 16 deletions src/elisa/data/ogip.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
43 changes: 0 additions & 43 deletions src/elisa/util/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down

0 comments on commit 52d5b39

Please sign in to comment.