Skip to the navigation links
Last modified: 26 October 2020


Caveats: set_analysis


In order to specify a value for the set_analysis() 'type' argument, 'quantity' must also be specified.

If one provides a 'type' value to set_analyis(), but not 'quantity', the value entered for 'type' gets misinterpreted as the data set 'id' argument. To avoid this error, the 'quantity' argument must also be specified.

For example, if one types:

sherpa> set_analysis("3c273", type="counts")
ArgumentTypeError: 'quantity' must be a string 

an error results because the syntax gets interpreted as 'set_analysis(id=1, quantity="3c273", type="counts")', which does not make sense; the default data set 'id=1' is assumed instead of the intended 'id="3c273"', and "3c273" is incorrectly entered as the 'quantity' value.


To avoid this set_analysis() error, both the 'quantity' and 'type' parameters should be provided; e.g.:

sherpa> set_analysis("3c273", "energy", "counts")