Commit a20840c0 authored by Zhang Xin's avatar Zhang Xin
Browse files

fix .so bug; adjust skybackgroundMap.py

parent 00a96bcb
...@@ -385,7 +385,7 @@ def generatePrimaryHeader(xlen = 9216, ylen = 9232, pointNum = '1', ra = 60, dec ...@@ -385,7 +385,7 @@ def generatePrimaryHeader(xlen = 9216, ylen = 9232, pointNum = '1', ra = 60, dec
h_prim['EXPTIME'] = exptime h_prim['EXPTIME'] = exptime
# Define file types # Define file types
file_type = {'SCI':'SCIE', 'BIAS':'BIAS', 'DARK':'DARK', 'FLAT':'FLAT', 'CRS':'cosmic_ray', 'CRD':'CRD','CALS':'CALS','CALF':'CALF'} file_type = {'SCI':'SCIE', 'BIAS':'BIAS', 'DARK':'DARK', 'FLAT':'FLAT', 'CRS':'CRS', 'CRD':'CRD','CALS':'CALS','CALF':'CALF'}
h_prim['FILETYPE'] = file_type[im_type] h_prim['FILETYPE'] = file_type[im_type]
co = coord.SkyCoord(ra, dec, unit='deg') co = coord.SkyCoord(ra, dec, unit='deg')
......
...@@ -4,5 +4,5 @@ from .CatalogBase import CatalogBase ...@@ -4,5 +4,5 @@ from .CatalogBase import CatalogBase
from .Quasar import Quasar from .Quasar import Quasar
from .Star import Star from .Star import Star
from .Stamp import Stamp from .Stamp import Stamp
from .SkybackgroundMap import * # from .SkybackgroundMap import *
# from .CosmicRay import CosmicRay # from .CosmicRay import CosmicRay
...@@ -14,7 +14,7 @@ from ObservationSim.Config import config_dir, ChipOutput ...@@ -14,7 +14,7 @@ from ObservationSim.Config import config_dir, ChipOutput
from ObservationSim.Config.Header import generatePrimaryHeader, generateExtensionHeader from ObservationSim.Config.Header import generatePrimaryHeader, generateExtensionHeader
from ObservationSim.Instrument import Telescope, Filter, FilterParam, FocalPlane, Chip from ObservationSim.Instrument import Telescope, Filter, FilterParam, FocalPlane, Chip
from ObservationSim.Instrument.Chip import Effects from ObservationSim.Instrument.Chip import Effects
from ObservationSim.MockObject import calculateSkyMap_split_g from ObservationSim.Straylight import calculateSkyMap_split_g
from ObservationSim.PSF import PSFGauss, FieldDistortion, PSFInterp from ObservationSim.PSF import PSFGauss, FieldDistortion, PSFInterp
from ObservationSim._util import get_shear_field, makeSubDir_PointingList from ObservationSim._util import get_shear_field, makeSubDir_PointingList
from ObservationSim.Astrometry.Astrometry_util import on_orbit_obs_position from ObservationSim.Astrometry.Astrometry_util import on_orbit_obs_position
......
...@@ -45,10 +45,10 @@ def calculateSkyMap_split_g(skyMap=None, blueLimit=4200, redLimit=6500, skyfn='s ...@@ -45,10 +45,10 @@ def calculateSkyMap_split_g(skyMap=None, blueLimit=4200, redLimit=6500, skyfn='s
fImg = galsim.Image(fimg) fImg = galsim.Image(fimg)
try: try:
with pkg_resources.files('ObservationSim.MockObject.data').joinpath(skyfn) as data_path: with pkg_resources.files('ObservationSim.Straylight.data.sky').joinpath(skyfn) as data_path:
skySpec = np.loadtxt(data_path) skySpec = np.loadtxt(data_path)
except AttributeError: except AttributeError:
with pkg_resources.path('ObservationSim.MockObject.data', skyfn) as data_path: with pkg_resources.path('ObservationSim.Straylight.data.sky', skyfn) as data_path:
skySpec = np.loadtxt(data_path) skySpec = np.loadtxt(data_path)
# skySpec = np.loadtxt(skyfn) # skySpec = np.loadtxt(skyfn)
spec = Table(np.array([skySpec[:, 0], skySpec[:, 1]]).T, names=('WAVELENGTH', 'FLUX')) spec = Table(np.array([skySpec[:, 0], skySpec[:, 1]]).T, names=('WAVELENGTH', 'FLUX'))
...@@ -277,10 +277,10 @@ def calculateSkyMap(xLen=9232, yLen=9126, blueLimit=4200, redLimit=6500, ...@@ -277,10 +277,10 @@ def calculateSkyMap(xLen=9232, yLen=9126, blueLimit=4200, redLimit=6500,
fimg = np.zeros_like(skyMap) fimg = np.zeros_like(skyMap)
fImg = galsim.Image(fimg) fImg = galsim.Image(fimg)
try: try:
with pkg_resources.files('ObservationSim.MockObject.data').joinpath(skyfn) as data_path: with pkg_resources.files('ObservationSim.Straylight.data.sky').joinpath(skyfn) as data_path:
skySpec = np.loadtxt(data_path) skySpec = np.loadtxt(data_path)
except AttributeError: except AttributeError:
with pkg_resources.path('ObservationSim.MockObject.data', skyfn) as data_path: with pkg_resources.path('ObservationSim.Straylight.data.sky', skyfn) as data_path:
skySpec = np.loadtxt(data_path) skySpec = np.loadtxt(data_path)
# skySpec = np.loadtxt(skyfn) # skySpec = np.loadtxt(skyfn)
......
...@@ -110,10 +110,10 @@ class Straylight(object): ...@@ -110,10 +110,10 @@ class Straylight(object):
self.slcdll = ctypes.CDLL(dllFn) self.slcdll = ctypes.CDLL(dllFn)
elif platForm == 'linux': elif platForm == 'linux':
try: try:
with pkg_resources.files('ObservationSim.Straylight.so').joinpath('libstraylight.dylib') as dllFn: with pkg_resources.files('ObservationSim.Straylight.lib').joinpath('libstraylight.so') as dllFn:
self.slcdll = ctypes.CDLL(dllFn) self.slcdll = ctypes.CDLL(dllFn)
except AttributeError: except AttributeError:
with pkg_resources.path('ObservationSim.Straylight.so', 'libstraylight.dylib') as dllFn: with pkg_resources.path('ObservationSim.Straylight.lib', 'libstraylight.so') as dllFn:
self.slcdll = ctypes.CDLL(dllFn) self.slcdll = ctypes.CDLL(dllFn)
# self.slcdll=ctypes.CDLL('./libstraylight.dylib') # self.slcdll=ctypes.CDLL('./libstraylight.dylib')
self.slcdll.Calculate.argtypes = [ctypes.c_double, ctypes.POINTER(ctypes.c_double), self.slcdll.Calculate.argtypes = [ctypes.c_double, ctypes.POINTER(ctypes.c_double),
......
from .Straylight import Straylight from .Straylight import Straylight
from .SkybackgroundMap import *
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment