-
Notifications
You must be signed in to change notification settings - Fork 0
Spectra can have POISSON ERRORS and no error column #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
ogip/spec.py
Outdated
|
||
if 'STAT_ERR' in f['SPECTRUM'].data.names: | ||
stat_err = f['SPECTRUM'].data['STAT_ERR'] | ||
elif 'POISSERR' in f['SPECTRUM'].header and f['SPECTRUM'].header['POISSERR']: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elif 'POISSERR' in f['SPECTRUM'].header and f['SPECTRUM'].header['POISSERR']: | |
elif f['SPECTRUM'].header.get('POISSERR'): |
ogip/spec.py
Outdated
elif 'POISSERR' in f['SPECTRUM'].header and f['SPECTRUM'].header['POISSERR']: | ||
if 'COUNTS' in f['SPECTRUM'].data.names: | ||
stat_err = np.sqrt(f['SPECTRUM'].data['COUNTS']) / f['SPECTRUM'].header['EXPOSURE'] | ||
elif 'RATE' in f['SPECTRUM'].data.names: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that anticipated in the standard? POISSERR with RATE columns? EXPOSURE might be somehow corrected (e.g. deadtime) and RATE*EXPOSURE can be non-int. Interpretation might be complex.
If it is anticipated, could you cite it in a comment for clarity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the POISSERR keywork is set, it is meant that uncertainty is the square root of counts. As the output is only using rate, a correct assumption is that RATE=COUNTS/EXPOSURE and STAT_ERR = sqrt(COUNTS)/EXPOSURE
ogip/spec.py
Outdated
if 'RATE' in f['SPECTRUM'].data.names: | ||
rate = f['SPECTRUM'].data['RATE'] | ||
elif 'COUNTS' in f['SPECTRUM'].data.names: | ||
rate = f['SPECTRUM'].data['COUNTS'] / f['SPECTRUM'].header['EXPOSURE'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Header is asked for EXPOSURE many times making the lines longer than needed.
Maybe:
rate = f['SPECTRUM'].data['COUNTS'] / f['SPECTRUM'].header['EXPOSURE'] | |
rate = f['SPECTRUM'].data['COUNTS'] / exposure |
and above
exposure = f['SPECTRUM'].header['EXPOSURE']
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also could you please add a test file?
Did you manage to make progress on this, @ferrigno ? Do you need any help? |
I think it is ready now. |
This is just an extension in case of Poissonian errors