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

Add option to use eval to compute derived values for Catalog arrays. #173

Merged
merged 6 commits into from
Mar 6, 2024

Conversation

rmjarvis
Copy link
Owner

@rmjarvis rmjarvis commented Mar 2, 2024

It is relatively common to want to compute some derived quantity from the columns in an input file rather than use them directly. For instance, when computing rho stats, the input catalog might have e_data and e_model, so you would want to compute the difference of these as "q".

Currently the standard practice is to just read the file directly, calculate the arrays you actually want and make a Catalog with the calculated arrays. @theoshutt suggested (#151) that we let TreeCorr do that work by specifying an eval calculation to be run on the columns that are in the file.

This PR implements this as follows for the case of a rho1 calculation:

rho1 = treecorr.GGCorrelation(min_sep=1, max_sep=200, nbins=20, sep_units='arcmin')
qcat = treecorr.Catalog(filename="catalog.fits", 
                        ra_col='RA', dec_col='DEC', ra_units='deg', dec_units='deg',
                        g1_eval='G1_DATA-G1_MODEL', g2_eval='G2_DATA-G2_MODEL',
                        extra_cols=['G1_DATA', 'G1_MODEL', 'G2_DATA', 'G2_MODEL'])
rho1.process(qcat)

@rmjarvis rmjarvis merged commit 7dda8f0 into main Mar 6, 2024
11 checks passed
@rmjarvis rmjarvis deleted the read_eval branch March 6, 2024 20:18
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

Successfully merging this pull request may close these issues.

1 participant