-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #120 from igmhub/add_fitter
added fitter. It reproduces DR12 fits
- Loading branch information
Showing
12 changed files
with
2,560 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env python | ||
|
||
from astropy.io import fits | ||
import scipy as sp | ||
import sys | ||
import argparse | ||
|
||
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) | ||
parser.add_argument('--prefix-pk', type = str, default = None, required=True, | ||
help = 'prefix to pk file') | ||
|
||
parser.add_argument('--out', type = str, default = None, required=True, | ||
help = 'output file') | ||
|
||
parser.add_argument('--zref', type = float, default = None, required=True, | ||
help = 'reference redshift') | ||
|
||
args=parser.parse_args() | ||
zref=args.zref | ||
pk=sp.loadtxt(args.prefix_pk+"_matterpower.dat") | ||
pkSB=sp.loadtxt(args.prefix_pk+"SB_matterpower.dat") | ||
col1=fits.Column(name="K",format='D',array=sp.array(pk[:,0])) | ||
col2=fits.Column(name="PK",format='D',array=sp.array(pk[:,1])) | ||
col3=fits.Column(name="PKSB",format='D',array=sp.array(pkSB[:,1])) | ||
cols=fits.ColDefs([col1,col2,col3]) | ||
head=fits.Header() | ||
head["ZREF"]=zref | ||
tbhdu=fits.BinTableHDU.from_columns(cols,header=head) | ||
tbhdu.writeto(args.out,clobber=True) | ||
|
Oops, something went wrong.