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

#93a Fix TreeCorr imports and 1d arrays in FITS table writing #93

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
7/13/18: Fix TreeCorr imports, 1d arrays in FITS writing (#93)
7/11/18: Update code to python3
3/17/16: Update documentation to Sphinx standard and add documentation build files (issue #17)
2/17/16: Changes to correlation function plots & documentation (issue #77)
Expand Down
5 changes: 5 additions & 0 deletions stile/file_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ def WriteASCIITable(file_name, data_array, fields=None, print_header=False):


def _coerceFitsFormat(fmt):
if fmt.subdtype:
if len(fmt.subdtype[1])>1:
raise RuntimeError("Cannot make a FITS table with a column containing arrays "+
"of greater than one dimension")
return str(fmt.subdtype[1][0])+_coerceFitsFormat(fmt.subdtype[0])
if 'S' in fmt.str or 'a' in fmt.str or 'U' in fmt.str:
return 'A'+fmt.str.split('S')[1]
elif fmt.str[1] in _fits_dict: # first character is probably a byte-order flag
Expand Down
7 changes: 5 additions & 2 deletions stile/treecorr_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
"""
import numpy
from . import file_io
import treecorr
from treecorr.corr2 import corr2_valid_params
try:
import treecorr
from treecorr.corr2 import corr2_valid_params
except ImportError:
pass


def Parser():
Expand Down