Telescope.py 931 Bytes
Newer Older
Fang Yuedong's avatar
Fang Yuedong committed
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
import numpy as np

class Telescope(object):
	def __init__(self, param=None, optEffCurve_path=None):
		self.diameter = 2.0 # in unit of meter
		if param is not None:
			self.diameter = param["diameter"]
		self.pupil_area = np.pi * (0.5 * self.diameter)**2
		if optEffCurve_path is not None:
			self.efficiency = self._get_efficiency(optEffCurve_path)

	def _get_efficiency(self, effCurve_path):
		""" Read in the efficiency of optics
			for each band
		Parameters:
			effCurve_path:	the path for efficiency file
		Returns:
			opticsEff:		a dictionary of efficiency (a scalar) for each band
		"""
		f = open(effCurve_path, 'r')
		for _ in range(2):
			header = f.readline()

		iline = 0
		opticsEff = {}
		for line in f:
			line = line.strip()
			columns = line.split()
			opticsEff[str(columns[0])] = float(columns[2])
		f.close()
		return opticsEff

	def _get_effCurve(self, effCurve_path):
		pass