Changeset 33
- Timestamp:
- May 20, 2014 3:23:45 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/skygenerator.py
r17 r33 5 5 import numpy as np 6 6 import scipy.constants as sc 7 8 import common.commonobjects as co 7 9 8 10 def black_body(temperature, wavenumber): … … 38 40 spatial_axis = beamsgenerator['spatial axis [arcsec]'] 39 41 40 # oversampling factor 41 # oversample = 10 42 oversample = 1 43 44 # print 'creating sky model with spatial dims [%s,%s] spectral dim %s',\ 45 # (oversample * npix, oversample * npix, nspec) 46 # print 'spatial oversampling: %s' % oversample 47 skymodel = np.zeros([npix, npix, nspec], np.float) 42 # skymodel is complex so that its fft can hold truncated version 43 # of infinitesimally sampled map - does that make sense? 44 skymodel = np.zeros([npix, npix, nspec], np.complex) 48 45 49 46 sky = self.parameters['substages']['Sky'] … … 83 80 84 81 if type.upper().strip() == 'POINT': 85 print 'creating point source'86 82 source_spectrum = self._create_point_source(xpos, ypos, 87 83 temperature, … … 94 90 self.result['sources'][sourcenum]['spectrum'] = source_spectrum 95 91 96 print 'sources', self.result['sources']97 92 self.result['sky model'] = skymodel 98 93 self.result['spatial axis'] = spatial_axis … … 115 110 return 116 111 117 # calculate fourier phase shift to move point at [0,0] to [rowpos, colpos] 112 # calculate fourier phase shift to move point at [0,0] to 113 # [rowpos, colpos] 118 114 shiftx = np.zeros([nx], np.complex) 119 115 shiftx[:nx/2] = np.arange(nx/2, dtype=np.complex) … … 135 131 # sensitivity and source emissivity 136 132 bbmod = np.zeros(np.shape(frequency_axis)) 137 print 'frequency axis', frequency_axis138 133 # ignore floating point errors 139 134 old_settings = np.seterr(all='ignore') … … 141 136 # simulate real-life 'rounded' cutoffs numerically 142 137 f1 = 1.0 / (1.0 + pow(cutoffmin/wn, 18) + pow(wn/cutoffmax, 24)) 143 print pow(cutoffmin/wn,18), pow(wn/cutoffmax,24)144 print temperature, wn, black_body(temperature, wn), f1, emissivity145 138 bbmod[iwn] = black_body(temperature, wn) * f1 * emissivity 146 139 # restore fp behaviour … … 163 156 skymodel[:,:,iwn] += temp 164 157 165 return bbmod 158 # return spectrum 159 axis = co.Axis(data=frequency_axis, title='wavenumber', units='cm-1') 160 spectrum = co.Spectrum(data=bbmod, axis=axis, title='Source spectrum', 161 units='W sr-1 m-2 Hz-1') 162 163 return spectrum 166 164 167 165 def __repr__(self):
Note:
See TracChangeset
for help on using the changeset viewer.