Skip to content

Commit

Permalink
Merge pull request #991 from igmhub/pk1d_test
Browse files Browse the repository at this point in the history
Pk1d test
  • Loading branch information
Waelthus authored Apr 14, 2023
2 parents e0357cb + 95d633f commit b428dc7
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bin/picca_Pk1D_postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def main(cmdargs):
help='Number of bootstrap iteration used')


args = parser.parse_args(sys.argv[1:])
args = parser.parse_args(cmdargs)

if (args.weight_method != 'no_weights') and (args.snr_cut_scheme is not None):
raise ValueError("""You are using a weighting method with a
Expand Down
Binary file modified py/picca/tests/data/test_Pk1D/Pk1D.fits.gz
Binary file not shown.
Binary file added py/picca/tests/data/test_Pk1D/meanPk1D.fits.gz
Binary file not shown.
31 changes: 30 additions & 1 deletion py/picca/tests/test_2_pk1d.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import unittest
import os
import glob
import shutil
import numpy as np
import fitsio
import healpy
Expand All @@ -21,7 +22,7 @@ def produce_folder(self):
"""

userprint("\n")
lst_fold = ["/Products/", "/Products/Pk1D/"]
lst_fold = ["/Products/", "/Products/Pk1D/", "/Products/meanPk1D/"]

for fold in lst_fold:
if not os.path.isdir(self._branchFiles + fold):
Expand Down Expand Up @@ -73,6 +74,34 @@ def test_Pk1D_raw(self):

return

def test_meanPk1D(self):
"""
Runs a simple test of Pk1d postprocessing
"""
import picca.bin.picca_Pk1D_postprocess as picca_Pk1D_postprocess

self._test = True
userprint("\n")
### Send
#- picca_Pk1D_postprocess.py takes all Pk1D*.fits.gz files in in-dir
# => copy a single file
shutil.copy(self._masterFiles + "/test_Pk1D/Pk1D.fits.gz",
self._branchFiles + "/Products/meanPk1D")
print(os.listdir(self._branchFiles + "/Products/meanPk1D"))
cmd = "picca_Pk1D_postprocess.py "
cmd += " --in-dir " + self._branchFiles + "/Products/meanPk1D"
cmd += " --output-file " + self._branchFiles + "/Products/meanPk1D/meanPk1D.fits.gz"
#- small sample => k,z-bins changed wrt default ones
cmd += " --zedge-min 2.1 --zedge-max 3.1 --zedge-bin 0.2"
cmd += " --kedge-min 0.015 --kedge-max 0.035 --kedge-bin 0.005"
picca_Pk1D_postprocess.main(cmd.split()[1:])

### Test
if self._test:
path1 = self._masterFiles + "/test_Pk1D/meanPk1D.fits.gz"
path2 = self._branchFiles + "/Products/meanPk1D/meanPk1D.fits.gz"
self.compare_fits(path1, path2, "picca_Pk1D_postprocess.py")


if __name__ == '__main__':
unittest.main()

0 comments on commit b428dc7

Please sign in to comment.