IDL> hsi_switch, /sim, /aspect_simThen the eventlist and the aspect solution are simulated.
To use a simulated eventlist and a true aspect solution, call
IDL> hsi_switch, /sim, /aspect_flight Or IDL> hsi_switch, /sim
To reset to the default behavior, which is eventlist from packets, and aspect solution from packets, call:
IDL> hsi_switch, /flight, /aspect_flight Or IDL> hsi_switch
Note that a call to hsi_switch always resets the environment, and the default for both eventlist and aspect data is to use the flight data, i.e., from the packets. This means that if you make two calls:
IDL> hsi_switch, /sim IDL> hsi_switch, /aspect_simYou'll end up with a simulated aspect solution, but a non-simulated eventlist, and the programs will crash. So please be sure to pass keywords for both the aspect solution and eventlist in the hsi_switch calls.
Here is a simple example. First, call hsi_switch and set /sim,/aspect_sim
IDL> hsi_switch, /sim, /aspect_sim
Then, create the object, if you want to save the data in a file, create an hsi_eventlist object. If you don't want to save the data, then create an image or spectrum, or lightcurve object, depending on what you want. (Note that if you want to use a true aspect solution, and not a simulated one, you must save the eventlist in a file). You can set control parameters here or by using separate calls to that objects set method. Here we will simulate 4 seconds of data, the default, for the default source, which is a double gaussian source located at position [600.0, 200.0] but change the reference time.
IDL> o = hsi_eventlist(sim_ut_ref='2-jul-2003 02:20:00')
The getdata method returns the simulated eventlist.
IDL> ev = o -> getdata(sim_xyoffset = [600.0, 200.0])
To save the data, use the write method, with time_range=[0,0], energy_band=[0,0] to insure that all of the data is written to the file:
IDL> o -> Write, 'hsi_test.fits', time_range=[0, 0], energy_band=[0, 0]
To recover the image, or spectrum, create the object, set the filename with the ev_filename control parameter, and use getdata():
IDL> img_obj = hsi_image(ev_filename = 'hsi_test.fits') IDL> image = img_obj -> getdata(xyoffset = [600.0, 200.0])
Note that we set the xyoffset in the image object. This is now
always necessary when using simulated data, otherwise the software
will set the xyoffset to the nearest flare value.
Note also that you never want to set any sim_ control parameter
for this image object. Setting a sim_ control parameter will cause
the object to start a new simulation, even though you passed in a filename.
This may change, but for now you need to be careful.
To see your image, try the plot method.
IDL> img_obj -> plot
All of the hsi_image methods and control parameters can be used as usual. For example, if you want to use the CLEAN algorithm, just set the image_alg control parameter.
IDL> img_obj -> getdata(image_alg = 'CLEAN')
In the above example, we used a simulated aspect solution for the simulation and for the image. For many applications, you might want to use the actual aspect solution obtained directly from the data. Here's how to do that: First set hsi_switch, /sim, or hsi_switch, /sim, /aspect_flight, then create the object. This ensures that the hsi_eventlist object knows that it wants to simulate the data, and not look for it in the level 0 data, but the aspect solution will know that it needs to obtain the solution from the level 0 data.
IDL> hsi_switch, /sim, /aspect_flight IDL> o = hsi_eventlist(sim_ut_ref = '2-jul-2003 02:20:00')
Next call getdata, and write the eventlist file
IDL> ev = o -> getdata() IDL> o -> Write, 'hsi_test_1.fits', time_range = [0, 0], energy_band = [0, 0]Getting the image back out is the same as before, but as of 15-oct-2004, you need a call to hsi_switch in order for the aspect solution to be found correctly. You also will get a bunch of error messages of the form:
% HSI_EVENTLIST::SET: You are setting simulation parameters even though you have not selected Simulations (via $HSI_USE_SIM). Not setting parameters. %Ignore those messages. This should be fixed in the future.
Now simply make the image.
IDL> img_obj = hsi_image(ev_filename = 'hsi_test_1.fits') IDL> image = img_obj -> getdata()
Comments to: jimm@ssl.berkeley.edu
16-Oct-2004, jmm