-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinputdata.py
54 lines (39 loc) · 1.13 KB
/
inputdata.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from __future__ import print_function
import numpy as np
import esutil
import astropy.io.fits as aft
#from . import standardValues
class InputMask(object):
"""
A class to set the input mask
parameters
----------
maskin: Input mask file or list of files
"""
def __init__(self, maskin):
self.files = maskin
self.file_dim = len(self.files)
#Check file type, if one or various, what type: image? healpix? mangle?
self.type = TYPE
'''
# get the band indices
st=np.argsort(self.bands)
temp=np.searchsorted(self.bands[st],self.zpts.zpts['BAND'][:])
self._bind = st[temp]
'''
def checktpye(self, maskin):
if isinstance(maskin, list):
print 'is a list of files'
self.checkfitstype(maskin, _list=True)
else:
if maskin.endswidth('ply') or maskin.endswidth('pol'):
print 'is a mangle file'
elif maskin.endswidth('fits'):
print self.checkfitstype(maskin)
def checkfitstype(self, maskin, _list=False):
if not _list:
hdulist = aft.open(maskin)
hdulist.close()
else:
for masc in maskin:
hdulist = aft.open(masc)