Skip to content
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

From edges-analysis: total power filter #9

Closed
steven-murray opened this issue Feb 11, 2020 · 3 comments
Closed

From edges-analysis: total power filter #9

steven-murray opened this issue Feb 11, 2020 · 3 comments

Comments

@steven-murray
Copy link
Contributor

In edges-analysis there is the possibility of doing a total power filter when averaging calibration spectra. Here's the code:

	# total power filter
	# ------------------
	tp = np.sum(ta_sel1, axis=1)
	W  = np.ones(len(tp))
	IN = np.arange(len(tp))
	
	Nsigma_tp = 3
	bad_old   = -1
	bad       =  0		
	iteration =  0
	
	

	while (bad > bad_old):

		iteration = iteration + 1
		print('Iteration: ' + str(iteration))
			
		std = np.std(tp[W>0])
		ave = np.mean(tp[W>0])
		res = tp-ave	

		IN_bad    = IN[(np.abs(res) > Nsigma_tp*std)]
		W[IN_bad] = 0
		
		bad_old = np.copy(bad)
		bad     = len(IN_bad)

		print('STD: ' + str(np.round(std,3)) + ' K')
		print('Number of bad points excised: ' + str(bad))
		print(IN_bad)

And in its original context: https://github.com/edges-collab/edges-analysis/blob/ac17ed386f4dfdccc8872d6fdf7d0926d899fecd/src/edges_analysis/basic.py#L1006

@gitul : is this useful to keep in this code?

@gitul
Copy link

gitul commented Feb 11, 2020 via email

@steven-murray
Copy link
Contributor Author

@gitul excellent, thanks. I'll work it into edges-cal.

PS: yes, you can reply via email, though usually clicking the link to go to the issue on Github gives you more options and better formatting :-)

@steven-murray
Copy link
Contributor Author

This seems to be more pertinent to field data than lab data, so I will leave it in edges-analysis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants