Skip to content

Commit

Permalink
Merge efce763 into c45205b
Browse files Browse the repository at this point in the history
  • Loading branch information
cramirezpe committed Jun 8, 2022
2 parents c45205b + efce763 commit b37c1de
Show file tree
Hide file tree
Showing 35 changed files with 1,494 additions and 4,197 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
sudo apt-get -y install libbz2-dev
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install pylint
pip install pylint==2.12.2
- name: This path
run: |
ls
Expand Down
36 changes: 32 additions & 4 deletions bin/picca_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import argparse
import fitsio
import numpy as np
import scipy.interpolate
import scipy.linalg
import h5py
import os.path
Expand Down Expand Up @@ -267,15 +268,42 @@ def main(cmdargs):
raise ValueError("Blinding strategy 'corr_yshift' requires"
" argument --blind_corr_type.")

# Read the blinding file and get the right template
blinding_filename = ('/global/cfs/projectdirs/desi/science/lya/y1-kp6/'
'blinding/y1_blinding_v1_standard_04_10_2021.h5')
# Check type of correlation and get size and regular binning
if args.blind_corr_type in ['lyaxlya', 'lyaxlyb']:
corr_size = 2500
rp_interp_grid = np.arange(2., 202., 4)
rt_interp_grid = np.arange(2., 202., 4)
elif args.blind_corr_type in ['qsoxlya', 'qsoxlyb']:
corr_size = 5000
rp_interp_grid = np.arange(-197.99, 202.01, 4)
rt_interp_grid = np.arange(2., 202, 4)
else:
raise ValueError("Unknown correlation type: {}".format(args.blind_corr_type))

if corr_size == len(xi):
# Read the blinding file and get the right template
blinding_filename = ('/global/cfs/projectdirs/desi/science/lya/y1-kp6/'
'blinding/y1_blinding_v1.2_standard_29_03_2022.h5')
else:
# Read the regular grid blinding file and get the right template
blinding_filename = ('/global/cfs/projectdirs/desi/science/lya/y1-kp6/'
'blinding/y1_blinding_v1.2_regular_grid_29_03_2022.h5')

if not os.path.isfile(blinding_filename):
raise RuntimeError("Missing blinding file. Make sure you are running at"
" NERSC or contact picca developers")
blinding_file = h5py.File(blinding_filename, 'r')
hex_diff = np.array(blinding_file['blinding'][args.blind_corr_type]).astype(str)
diff = np.array([float.fromhex(x) for x in hex_diff])
diff_grid = np.array([float.fromhex(x) for x in hex_diff])

if corr_size == len(xi):
diff = diff_grid
else:
# Interpolate the blinding template on the regular grid
interp = scipy.interpolate.RectBivariateSpline(
rp_interp_grid, rt_interp_grid,
diff_grid.reshape(len(rp_interp_grid), len(rt_interp_grid)), kx=3, ky=3)
diff = interp.ev(r_par, r_trans)

# Check that the shapes match
if np.shape(xi) != np.shape(diff):
Expand Down
4 changes: 2 additions & 2 deletions py/picca/delta_extraction/data_catalogues/desi_tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def read_data(self):

if "cumulative" in self.input_directory:
petal_tile_night = [
f"{entry['PETAL_LOC']}-{entry['TILEID']}-thru{entry['LASTNIGHT']}"
f"{entry['PETAL_LOC']}-{entry['TILEID']}-thru{entry['LAST_NIGHT']}"
for entry in self.catalogue
]
else:
Expand Down Expand Up @@ -248,7 +248,7 @@ def read_file(self, filename, catalogue):
if "cumulative" in self.input_directory:
select = ((catalogue['TILEID'] == tile_spec) &
(catalogue['PETAL_LOC'] == petal_spec) &
(catalogue['LASTNIGHT'] == night_spec))
(catalogue['LAST_NIGHT'] == night_spec))
else:
select = ((catalogue['TILEID'] == tile_spec) &
(catalogue['PETAL_LOC'] == petal_spec) &
Expand Down

0 comments on commit b37c1de

Please sign in to comment.