本文整理匯總了Python中MOSFIRE.IO.parse_header_for_bars方法的典型用法代碼示例。如果您正苦於以下問題:Python IO.parse_header_for_bars方法的具體用法?Python IO.parse_header_for_bars怎麽用?Python IO.parse_header_for_bars使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MOSFIRE.IO
的用法示例。
在下文中一共展示了IO.parse_header_for_bars方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: set_header
# 需要導入模塊: from MOSFIRE import IO [as 別名]
# 或者: from MOSFIRE.IO import parse_header_for_bars [as 別名]
def set_header(self, header, ssl=None, msl=None, asl=None, targs=None):
'''Passed "header" a FITS header dictionary and converts to a Barset'''
self.pos = np.array(IO.parse_header_for_bars(header))
self.set_pos_pix()
self.ssl = ssl
self.msl = msl
self.asl = asl
self.targs = targs
def is_alignment_slit(slit):
return (np.float(slit["Target_Priority"]) < 0)
# If len(ssl) == 0 then the header is for a long slit
if (header['MASKNAME'] == 'long2pos'):
info("long2pos mode in CSU slit determination")
self.long2pos_slit = True
if (len(ssl) == 0):
self.long_slit = True
start = np.int(msl[0]["Slit_Number"])
stop = np.int(msl[-1]["Slit_Number"])
for mech_slit in msl:
mech_slit["Target_in_Slit"] = "long"
self.ssl = np.array([("1", "??", "??", "??", "??", "??", "??", msl[0]['Slit_width'],
(stop-start+1)*7.6, "0", "long", "0")],
dtype= [ ('Slit_Number', '|S2'),
('Slit_RA_Hours', '|S2'), ('Slit_RA_Minutes', '|S2'), ('Slit_RA_Seconds', '|S5'),
('Slit_Dec_Degrees', '|S3'), ('Slit_Dec_Minutes', '|S2'), ('Slit_Dec_Seconds', '|S5'),
('Slit_width', '|S5'), ('Slit_length', '|S5'), ('Target_to_center_of_slit_distance', '|S5'),
('Target_Name', '|S80'), ('Target_Priority', '|S1')])
self.scislit_to_slit = [ np.arange(start,stop) ]
ssl = None
# Create a map between scislit number and mechanical slit
# recall that slits count from 1
if ssl is not None:
prev = self.msl[0]["Target_in_Slit"]
v = []
for science_slit in ssl:
targ = science_slit["Target_Name"]
v.append([int(x) for x in self.msl.field("Slit_Number")[np.where(self.msl.field("Target_in_Slit").rstrip() == targ)[0]]])
self.scislit_to_slit = v
if (len(self.scislit_to_slit) != len(ssl)) and not (self.long_slit
and len(self.scislit_to_slit) == 1):
error("SSL should match targets in slit")
raise Exception("SSL should match targets in slit")