diff --git a/observation_sim/mock_objects/Quasar.py b/observation_sim/mock_objects/Quasar.py index b27cb8ce97a6dff472cc08ab9752dc22f05424e4..3589b0d1e80f3977b9fc83f7624b02557a0b24ae 100755 --- a/observation_sim/mock_objects/Quasar.py +++ b/observation_sim/mock_objects/Quasar.py @@ -98,7 +98,7 @@ class Quasar(MockObject): del self.sed def getGSObj(self, psf, g1=0, g2=0, flux=None, filt=None, tel=None, exptime=150.): - if flux == None: + if flux is None: flux = self.getElectronFluxFilt(filt, tel, exptime) qso = galsim.Gaussian(sigma=1.e-8, flux=1.) qso = qso.withFlux(flux) diff --git a/observation_sim/mock_objects/Stamp.py b/observation_sim/mock_objects/Stamp.py index 51de71c9b42cbcbc54f5a02045c4901030597aa3..d39ace7ec70edac6904dc2e992bb067a3c6c3872 100644 --- a/observation_sim/mock_objects/Stamp.py +++ b/observation_sim/mock_objects/Stamp.py @@ -21,7 +21,7 @@ class Stamp(MockObject): del self.sed def drawObj_multiband(self, tel, pos_img, psf_model, bandpass_list, filt, chip, nphotons_tot=None, g1=0, g2=0, exptime=150., fd_shear=None): - if nphotons_tot == None: + if nphotons_tot is None: nphotons_tot = self.getElectronFluxFilt(filt, tel, exptime) try: diff --git a/observation_sim/mock_objects/Star.py b/observation_sim/mock_objects/Star.py index c27b4bab7036874913088a156f07b137dd340f13..c0aceb3d1ea5357f09a41fee421ca95c561e4311 100755 --- a/observation_sim/mock_objects/Star.py +++ b/observation_sim/mock_objects/Star.py @@ -22,7 +22,7 @@ class Star(MockObject): del self.sed def getGSObj(self, psf, g1=0, g2=0, flux=None, filt=None, tel=None, exptime=150.): - if flux == None: + if flux is None: flux = self.getElectronFluxFilt(filt, tel, exptime) # star = galsim.Gaussian(sigma=1.e-8, flux=1.) star = galsim.DeltaFunction() @@ -35,7 +35,7 @@ class Star(MockObject): raise ValueError( "!!!The number of PSF profiles and the number of bandpasses must be equal.") objs = [] - if nphotons_tot == None: + if nphotons_tot is None: nphotons_tot = self.getElectronFluxFilt(filt, tel, exptime) try: diff --git a/observation_sim/mock_objects/_util.py b/observation_sim/mock_objects/_util.py index f5b0c06db23e4f4a1bd85e0dae3f3b413bbf79c4..5707fd4f561cb7ddaa7c8b86d86a397cfa7d6237 100755 --- a/observation_sim/mock_objects/_util.py +++ b/observation_sim/mock_objects/_util.py @@ -58,7 +58,7 @@ def seds(sedlistn, seddir="./", unit="A"): read SEDs and save into Python dictionary Parameters: - sedlistn: filename of the sed template list and corresponding intrinsic + sedlistn: filename of the sed template list and corresponding intrinsic extinction model, see tmag_dz.py for detailes listdir: directory of the list unit: wavelength unit of the input templates @@ -420,7 +420,7 @@ def sed2mag(mag_i, sedCat, filter_list, redshift=0.0, av=0.0, redden=0): def eObs(e1, e2, g1, g2): """ - Calculate the sheared (observed) ellipticity using the + Calculate the sheared (observed) ellipticity using the intrinsic ellipticity and cosmic shear components. Parameters: @@ -558,7 +558,7 @@ def getNormFactorForSpecWithABMAG(ABMag=20., spectrum=None, norm_thr=None, sWave eWave: the end of norm_thr Return: - the normalization factor flux of AB system(fix a band and magnitude ) /the flux of inpute spectrum(fix a band) + the normalization factor flux of AB system(fix a band and magnitude ) /the flux of inpute spectrum(fix a band) """ spectrumi = interpolate.interp1d(spectrum['WAVELENGTH'], spectrum['FLUX']) norm_thri = interpolate.interp1d( diff --git a/tests/test_SpecDisperse.py b/tests/test_SpecDisperse.py index 4a6553eae3e617f19c173bad1ec61f2c475326f2..df7a7801ff447661e94f6e6aa243d96e3b41abd8 100644 --- a/tests/test_SpecDisperse.py +++ b/tests/test_SpecDisperse.py @@ -428,8 +428,8 @@ class TestSpecDisperse(unittest.TestCase): plt.xlim(6200, 10000) plt.ylim(1, 4) plt.yscale('log') - plt.xlabel('$\lambda$') - plt.ylabel('$F\lambda$') + plt.xlabel(r'$\lambda$') + plt.ylabel(r'$F\lambda$') plt.legend(['one spec', 'split in 8000 A']) plt.show() diff --git a/tests/test_Straylight.py b/tests/test_Straylight.py index 90f82a98a85da31fae83b1096be593d4634b1047..63c1376a3a610d5f2fd3c9f11157b93dc9e5ede7 100644 --- a/tests/test_Straylight.py +++ b/tests/test_Straylight.py @@ -192,7 +192,7 @@ class TestStraylight(unittest.TestCase): plt.figure() plt.plot(spec['WAVELENGTH'], spec['FLUX'], 'r') plt.xlabel('WAVELENGTH') - plt.ylabel('F$\lambda$(erg/s/cm2/A/arcsec2)') + plt.ylabel(r'F$\lambda$(erg/s/cm2/A/arcsec2)') plt.xlim(2000, 10000) plt.show() median = np.median(sl_e_pix[0:tnum]) diff --git a/tests/test_darknoise_func.py b/tests/test_darknoise_func.py index 42bf398a5b4d5114f67377aff8f45931843e191d..58afd458d6a562d1ce19c0031629d11812a41ec8 100644 --- a/tests/test_darknoise_func.py +++ b/tests/test_darknoise_func.py @@ -10,11 +10,11 @@ import yaml from observation_sim.instruments import Chip, Filter, FilterParam, FocalPlane -### test FUNCTION --- START ### +# test FUNCTION --- START ### def get_base_img(img, chip, read_noise, readout_time, dark_noise, exptime=150., InputDark=None): - if InputDark == None: + if InputDark is None: # base_level = read_noise**2 + dark_noise*(exptime+0.5*readout_time) # base_level = dark_noise*(exptime+0.5*readout_time) base_level = dark_noise*(exptime) @@ -31,7 +31,7 @@ def get_base_img(img, chip, read_noise, readout_time, dark_noise, exptime=150., base_img2[ny:, :] = arr[::-1, :] base_img2[:, :] = base_img2[:, :]*(readout_time/ny)*dark_noise return base_img1+base_img2 -### test FUNCTION --- END ### +# test FUNCTION --- END ### def defineCCD(iccd, config_file): diff --git a/tools/target_location_check.py b/tools/target_location_check.py index 11f22bac7e8eb8d74606c4e5d003ac92e5e23633..6e0f525ea3b4a35d95140f04cb2f7d470ff69eec 100644 --- a/tools/target_location_check.py +++ b/tools/target_location_check.py @@ -26,7 +26,7 @@ def focalPlaneInf(ra_target, dec_target, ra_point, dec_point, image_rot=-113.433 float, in unit of degrees; image_rot : orientation of the camera with respect the sky; float, in unit of degrees; - NOTE: image_rot=-113.4333 is the default value + NOTE: image_rot=-113.4333 is the default value in current CSST image simulation; figout : location of the target object in the focal plane; str @@ -36,7 +36,7 @@ def focalPlaneInf(ra_target, dec_target, ra_point, dec_point, image_rot=-113.433 the pointing center (ra_point dec_point) of the telescope 1) open a terminal 2) type >> python TargetLocationCheck.py ra_target dec_target ra_point dec_point - or type >> python TargetLocationCheck.py ra_target dec_target ra_point dec_point -image_rot=floatNum + or type >> python TargetLocationCheck.py ra_target dec_target ra_point dec_point -image_rot=floatNum or type >> python TargetLocationCheck.py ra_target dec_target ra_point dec_point -image_rot=floatNum -figout=FigureName """ print("^_^ Input target coordinate: [Ra, Dec] = [%10.6f, %10.6f]" % ( @@ -105,7 +105,7 @@ def ccdParam(): def getTanWCS(ra, dec, img_rot, pix_scale=0.074): - """ + """ Get the WCS of the image mosaic using Gnomonic/TAN projection Parameter: ra, dec: float @@ -221,8 +221,8 @@ def ccdLayout(xpixTar, ypixTar, figout="ccdLayout.pdf"): ax.text(ix0+500, iy0+1500, "%s#%s" % (fType, ischip), fontsize=12, color="grey") ax.plot(xpixTar, ypixTar, "r*", ms=12) - ax.set_xlabel("$X\,[\mathrm{pixels}]$", fontsize=20) - ax.set_ylabel("$Y\,[\mathrm{pixels}]$", fontsize=20) + ax.set_xlabel(r"$X\,[\mathrm{pixels}]$", fontsize=20) + ax.set_ylabel(r"$Y\,[\mathrm{pixels}]$", fontsize=20) ax.invert_yaxis() ax.axis('off') plt.savefig(figout)