xInPixelInCam, yInPixelInCam = checkBoundary(xInPixelInCam, yInPixelInCam, 150, 1850, 150, 3912) for ii in range(len(xInPixelInCam)): skySim.addStarByChipPos(camera, obs, sensor, starId, xInPixelInCam[ii], yInPixelInCam[ii], starMag[ii], folderPath2FocalPlane) starId += 1 # Export sky information skySim.exportSkyToFile(outputFilePath) # Write the star physical command file cmdFilePath = tele.writeCmdFile(outputDir, cmdSettingFile=cmdSettingFile, cmdFileName="starWfsAll.cmd") # Write the star instance file # Use the rot=0 temporally. Need to update it latter. instFilePath = tele.writeStarInstFile(outputDir, skySim, obsId, aFilter, boresight=(RA, Dec), rot=cameraRotation, mjd=mjdTime, sedName="sed_500.txt", wfSensorOn=True, instSettingFile=instSettingFile, instFileName="starWfsAll.inst")
# Update the telescope degree of freedom dofInUm = np.zeros(50) # Camera piston (Change the unit from mm to um) dofInUm[5] = ii * tele.defocalDisInMm * 1e3 # Set the degree fo freedom on telescope tele.setDofInUm(dofInUm) # Write the perturbation command file # The perturbation condition is the same for two exposures. if (ii == -1): # Write the star physical command file cmdFilePath = tele.writeCmdFile(outputDir, cmdSettingFile=cmdSettingFile, cmdFileName="starLsstFam.cmd") # Write the star instance file # Set the rot=0 for the simplification. But actually, there is no correction for ComCam. # However, the coordinate is affected by this. instFilePath = tele.writeStarInstFile( outputDir, skySim, obsIdList[str(ii)], aFilter, boresight=(RA, Dec), rot=cameraRotation, mjd=mjdTime, sedName="sed_500.txt", sciSensorOn=True,
# Set the degree fo freedom on telescope tele.setDofInUm(dofInUm) # Write the perturbation command file # The perturbation condition is the same for two exposures. if (ii == -1): pertCmdFilePath = tele.writePertBaseOnConfigFile( outputDir, zAngleInDeg=zAngleInDeg, seedNum=iSim, saveResMapFig=True) # Write the star physical command file cmdFilePath = tele.writeCmdFile(outputDir, cmdSettingFile=cmdSettingFile, pertFilePath=pertCmdFilePath, cmdFileName="starComCam.cmd") # Write the star instance file # Set the rot=0 for the simplification. But actually, there is no correction for ComCam. # However, the coordinate is affected by this. instFilePath = tele.writeStarInstFile( outputDir, skySim, obsId, aFilter, boresight=boresight, rot=0, mjd=mjdTime, sedName="sed_500.txt", sciSensorOn=True,
# Set the Telescope facade class phoSimCommu = PhosimCommu() tele = TeleFacade(phoSimCommu=phoSimCommu) tele.setSubSysConfigFile(phosimDir=phosimDir) # Update the telescope degree of freedom dofInUm = np.zeros(50) # Camera dx dofInUm[6] = 1000 tele.setDofInUm(dofInUm) # Write the physical command file cmdFilePath = tele.writeCmdFile(outputDir, cmdSettingFile=cmdSettingFile, cmdFileName="opd.cmd") # Write the instance file instFilePath = tele.writeOpdInstFile(outputDir, metr, obsId, aFilter, opdWaveInNm, instSettingFile=instSettingFile, instFileName="opd.inst") # Get the argument to run the PhoSim logFilePath = os.path.join(outputImgDir, "opdPhoSim.log") argString = tele.getPhoSimArgs(instFilePath, cmdFilePath=cmdFilePath,