Nicole Drakos

Research Blog

Welcome to my Research Blog.

This is mostly meant to document what I am working on for myself, and to communicate with my colleagues. It is likely filled with errors!

This project is maintained by ndrakos

MIRISim Updates Part III

In this post I’m going to get my MIRISim pipeline working (see previous post here)

Updates to MiriB

There are a couple small updates I made to the MiriB script described in the previous post.

Save pointing information

Now, for each visit, I save all the information needed to fix the wcs, i.e.

np.savetxt(mypath + '/pointing.dat',np.array([telescope_v1_ra,telescope_v1_dec,local_roll])).

Dithering pattern

MIRISim was not able to read in the dither pattern properly. I made sure to have the proper format/delimiter,

np.savetxt(mypath + '/dither.dat', np.array([X,Y]).T, fmt='%+.4f',delimiter=',')

MiriD

This post is mostly about running MiriSim. The base code is as follows. Note that I replaced the mirisim run command with a function that I define (run_miri). This code uses Daizhong’s script to call all the steps that are inside Miri’s run function separately, and fixes the WCS at the appropriate place.

##################################
# Loop through visits
##################################
from mirisim.config_parser import SimulatorConfig
from mirisim.obssim import ObservationSimulation
import mirisim.config_parser as c

for obs in obs_num:

    ##################################
    #Set up simulation
    #################################

    #Go to currect folder
    mypath = miri_path + 'Obs' + str(int(obs)) + '/'
    os.chdir(mypath)

    #set up simulation
    simulator = SimulatorConfig.from_default()
    config = c.SimConfig('config.ini')
    scene = c.SceneConfig('scene.ini')

    #fix RA, Dec, Pointing
    mydata = np.loadtxt(mypath+'pointing.dat')
    telescope_v1_ra,telescope_v1_dec,telescope_v3_pa,local_roll  = mydata
    config['Pointing_and_Optical_Path']['Pointing_Centre'] = {}
    config['Pointing_and_Optical_Path']['Pointing_Centre']['RA'] = telescope_v1_ra
    config['Pointing_and_Optical_Path']['Pointing_Centre']['DEC'] = telescope_v1_dec
    config['Pointing_and_Optical_Path']['Pointing_Centre']['PosAng'] = -local_roll
                                                                         ## needs minus here
    mysim = ObservationSimulation(config,scene,simulator,mypath,path_cbp)

    ##################################
    #Run Simulation
    #################################


    run_miri(mysim,mydata)

Error 1

Was getting some error “Validator’ object has no attribute ‘comment_stack” at the line exposure.write_illum_model(illum_model, fn_part) in Daizhong’s script. This looks like a problem with one of the dependancies.

Attempt 1: I reinstalled the mirisim enviornment. The original version of run_miri also needs mirage, so I downloaded to the mirisim environment in the same way Daizhong did: pip install –upgrade git+https://github.com/spacetelescope/mirage.git. This did not fix it.

Attempt 2: I moved all of the mirage dependant steps into MiriB (i.e. just saved more things in the pointing file), and then reinstalled mirisim. This worked!

To-do/check

My code seems to run now, and generate output for all the expected visits. I need to check (1) the sources are in the right place, and (2) the observations are in the right place/at the right angle

Other things to check (from previous post):

  1. Are the units correct in BUNIT?

  2. Is the pixel resolution of the FITS image fine, or should i make it more precise?

  3. Right now I am just repeating the same image to make a data cube. How does MIRISIM interpolate between images in the cube?

  4. How to add stars?

  5. I am cutting out 0.01x0.01 degrees of the scene around the centre of the visit. Is this enough?


« MIRISim Updates Part II
MIRISim Updates Part IV »