.. SPDX-FileCopyrightText: 1992-2026 NWO-I/SRON Space Research Organisation Netherlands
..
.. SPDX-License-Identifier: CC-BY-4.0

.. _sec:cnts:

Cnts: Show counts statistics 
============================

Overview
~~~~~~~~

This command shows counts statistics for a given energy, wavelength
or channel interval. The output shows the net number of source counts
in the range, the net source count rate, the background counts and
the background count rate. All numbers include the errors.  

The range to calculate the statistics for can be specified either as a channel range (no
units required) or in eiter any of the following units: keV, eV,
Rydberg, Joule, Hertz, Å, nanometer, with the following abbrevations:
kev, ev, ryd, j, hz, ang, nm. 

Interfaces
~~~~~~~~~~

 - Python interface: :ref:`pyapi-data_cnts`.
 - Fortran interface: :ref:`spexapi_cnts`.

Syntax
~~~~~~

The following syntax rules apply:

| ``cnts [instrument #i1] [region #i2] #r`` : Use the range #r in calculating
  the data. The instrument #i1 and the region #i2 must be specified if
  either there are more than 1 instrument or more than 1 region used in
  the data sets.
| ``cnts [instrument #i1] [region #i2] #r unit #a`` : Same as the above,
  but now the units #a in which the range #r of data points to be calculated
  is specified in any of the units mentioned above.

Examples
~~~~~~~~

| ``cnts 1000:1500`` : Integrate over the data channels 1000:1500 for calculating
  the rates.
| ``cnts instrument 1 region 1 1000:1500`` : Integrate over the data channels
  1000:1500 of the first instrument and the first region in the data set
  for calculating the rates.
| ``cnts instrument 1 region 1 1:1.5 unit kev`` : Same as the above, but
  now the units are specified as keV instead of in data channels.
| ``cnts 1000:1500 unit ev`` : Integrate over the data points between 1000 and
  1500 eV for calculating the rates. Note that in this case the input
  data should come from only one instrument and should contain no
  regions.
