E0102 Event-2D Demo



Back to Event-2D Analysis page
8/22/07
dd@space.mit.edu

The command window text is given below along with any plots or images created interspersed appropriately.
The user-typed input is shown in bold.


Read in the desired data with a user-supplied file...
hydra> .source e0102_data
 Reading file:  acisf03520N002_evt2.fits
 - - -
 Reading file:  acisf03520N002_evt2.fits
 - - -
 Reading file:  obs120_proc120_evt2.fits
 - - -
 Reading file:  obs120_proc120_evt2.fits
 - - -
 - Data:                                     e2d_meta[id].;  e2d_data[id].;  e2d_view[id].
  id  Mission-grat-instrument    Date         2D-axes     ignore  prt  m src   events(k)   exp(ks)          target  
   1        CHANDRA-HETG-ACIS  1999.741    TG_LAM,TG_D       0     2  -1  1       24.28      87.1         E0102-72.3
>  2        CHANDRA-HETG-ACIS  1999.741    TG_LAM,TG_D       0     2   1  1       17.20      87.1         E0102-72.3
  10        CHANDRA-NONE-ACIS  2003.086            X,Y       0     -   -  -       69.20       7.6 E0102-72[S3,-120,-1,0,0]
  11        CHANDRA-NONE-ACIS  2003.086            X,Y       0     -   -  -       14.35       7.6 E0102-72[S3,-120,-1,0,0]
 - - -

Define the Source model with a user-supplied file and list the spectra and components in it...
hydra> .source e0102_model  
 Spectrum created from: e0102_simple_noNH.par
 - - -
hydra> s3d_list_spectra;
 - Spectra:                                                                  s3d_spec[id].
  id    min - max es   ph/ks/100cm^2    file
   1    0.31 - 12.40     3050.18        e0102_simple_noNH.par
 - - -
hydra> s3d_list_comps;
 - Components:                                                               s3d_comp[id].
  id         name   ignore   type       norm   ispec   vtype  velval    rndint          rndclr
   1      cylinder     0     xray         0.6    1       1         0        1          [1,0,0]
   2     sph-shell     0     xray         0.4    1       1         0        1          [0,0,1]
 - - -
hydra>

Execute the end-to-end process of going from user parameters to the final figure of merit (FOM)...
hydra> e2d_pars2fom;
         Event2D:   parameters to FOM
   - update parameters                                                  [e2d_update_pars]
   - updating the model ...                                                  [s3d_update]
      o check/update foreground NH ...
      o check/update spectra ...
      o check/update the component geometry ...
   - Dataset 1: generating photons from the model...                   [s3d_xray_photons]
      o generating 51479 MC photons...
      o generating 34319 MC photons...
      o Total generated =  85798
      o Total kept after NH/arf =  62594     ( 72.95 % )
             1: pass photons through instrument simulation...             [e2d_inst_xray]
      o Total kept after FRAC =  59441     ( 94.96 % )
             1: load simulation into model arrays                          [e2d_inst2mod]
   - Dataset 2: generating photons from the model...                   [s3d_xray_photons]
      o generating 44310 MC photons...
      o generating 29540 MC photons...
      o Total generated =  73850
      o Total kept after NH/arf =  45751     ( 61.95 % )
             2: pass photons through instrument simulation...             [e2d_inst_xray]
      o Total kept after FRAC =  42517     ( 92.93 % )
             2: load simulation into model arrays                          [e2d_inst2mod]
   - Dataset 10: generating photons from the model...                   [s3d_xray_photons]
      o generating 41049 MC photons...
      o generating 27366 MC photons...
      o Total generated =  68415
      o Total kept after NH/arf =  46308     ( 67.68 % )
             10: pass photons through instrument simulation...             [e2d_inst_xray]
             10: load simulation into model arrays                          [e2d_inst2mod]
   - Dataset 11: generating photons from the model...                   [s3d_xray_photons]
      o generating 41049 MC photons...
      o generating 27366 MC photons...
      o Total generated =  68415
      o Total kept after NH/arf =  46389     ( 67.8 % )
             11: pass photons through instrument simulation...             [e2d_inst_xray]
             11: load simulation into model arrays                          [e2d_inst2mod]
   - calculate the figure of merit...                                      [e2d_eval_fom]
      o Data-Model 1,  chi^2 = 4238.02  from 3199 cells;   chi^2/cell = 1.3248;  sum(D)/sum(M) = 1.16954
      o Data-Model 2,  chi^2 = 2606.07  from 2589 cells;   chi^2/cell = 1.00659;  sum(D)/sum(M) = 1.20748
      o Data-Model 10,  chi^2 = 11962.5  from 1517 cells;   chi^2/cell = 7.88566;  sum(D)/sum(M) = 1.18934
      o Data-Model 11,  chi^2 = 2600.31  from 1231 cells;   chi^2/cell = 2.11235;  sum(D)/sum(M) = 1.43107
      o Total FOM = 21406.9
 - - -
hydra>

Look at the Model spectra and components...
hydra> s3d_plot_spectrum(1);
 Graphics device/type (? to see list, default /XSERVE): 

hydra>

hydra> s3d_plot_nh;         

hydra> 

hydra> s3d_view_comps(2);
normalization took: 0.325856 sec

hydra>    

hydra> s3d_proj_comps;

hydra>

Look at the Data, Model, and Residuals for the datasets...
hydra> e2d_view_resid(1); 
 - - -
     green indicates  |chi| < 1
 - - -
Residual: Color-coded residual image,
indicating where Data >> Model (red), where Data << Model (blue),
and where Data ~ Model to within statistics (green-black).
Data:

Model:
hydra>


hydra> e2d_view_resid(2);
 - - -
     green indicates  |chi| < 1
 - - -

hydra>

hydra> e2d_view_resid(10); 
 - - -
     green indicates  |chi| < 3
 - - -
At Left: Color-coded residual image,
indicating where Data >> Model (red), where Data << Model (blue),
and where Data ~ Model to within statistics (green-black).

hydra>        

hydra> e2d_view_resid(11);
 - - -
     green indicates  |chi| < 2
 - - -
At Left: Color-coded residual image,
indicating where Data >> Model (red), where Data << Model (blue),
and where Data ~ Model to within statistics (green-black).

hydra>        

A K-S test is a useful way to compare Data/Model in 1-D...
hydra> e2d_plot_ks(1,1);  
      o Data-Model 1,  K-S on TG_LAM: Max |diff| is 0.0243432  at 13.6613 Angstrom

hydra>        

hydra> e2d_plot_ks(2,1);
      o Data-Model 2,  K-S on TG_LAM: Max |diff| is 0.0448741  at 10.0409 Angstrom

hydra>  

The changes in the FOM with a scaling of the overall model norm can be seen without resimulation and used to set better norm values...
hydra> dummy = e2d_norm_scale(0.8, 1.2, 0.01999);
- - -
   ...
 - - -
   Minimum FOM for norm factor of  0.85997
      o Data-Model 1,  chi^2 = 3854.8  from 3142 cells;   chi^2/cell = 1.22686;  sum(D)/sum(M) = 1.36343
      o Data-Model 2,  chi^2 = 2407.81  from 2587 cells;   chi^2/cell = 0.930734;  sum(D)/sum(M) = 1.39959
      o Data-Model 10,  chi^2 = 11166.4  from 1518 cells;   chi^2/cell = 7.35601;  sum(D)/sum(M) = 1.38927
      o Data-Model 11,  chi^2 = 2686.51  from 1253 cells;   chi^2/cell = 2.14406;  sum(D)/sum(M) = 1.68139
      o Total FOM = 20115.5
 - - -


hydra> s3d_comp[1].norm = 0.86 * s3d_comp[1].norm;
hydra> s3d_comp[2].norm = 0.86 * s3d_comp[2].norm;

List the user-defined (in 'model.sl file) Source-3D parameter structure and values:
hydra> print(s3d_ps); 
    par1 = 13
    par2 = 16
    par3 = 8
    velrad = 0
    cylx = 0
    cyly = 3
    sphin = 16.5
    sphout = 20
    sphx = 0
    sphy = 3
hydra>         

Change some of the parameters... Note in particular the value of velrad is changed from 0 to 2600 km/s to give an Hubble-like velocity field reaching 2600 km/s at 30" from the model center.
hydra> s3d_ps.cylx = -0.5;
hydra> s3d_ps.par1=13.5;
hydra> s3d_ps.par2=16.5;
hydra> s3d_ps.cyly = 2.75;    
hydra> s3d_ps.sphout = 21.0;
hydra> s3d_ps.velrad = 2600.0;
hydra>

And recompute the FOM ...
hydra> e2d_pars2fom;          
         Event2D:   parameters to FOM
   - update parameters                                                  [e2d_update_pars]
   - updating the model ...                                                  [s3d_update]
      o check/update foreground NH ...
      o check/update spectra ...
      o check/update the component geometry ...
   - Dataset 1: generating photons from the model...                   [s3d_xray_photons]
      o generating 44272 MC photons...
      o generating 29515 MC photons...
      o Total generated =  73787
      o Total kept after NH/arf =  54070     ( 73.27 % )
             1: pass photons through instrument simulation...             [e2d_inst_xray]
      o Total kept after FRAC =  51408     ( 95.07 % )
             1: load simulation into model arrays                          [e2d_inst2mod]
   - Dataset 2: generating photons from the model...                   [s3d_xray_photons]
      o generating 38107 MC photons...
      o generating 25404 MC photons...
      o Total generated =  63511
      o Total kept after NH/arf =  39583     ( 62.32 % )
             2: pass photons through instrument simulation...             [e2d_inst_xray]
      o Total kept after FRAC =  36787     ( 92.93 % )
             2: load simulation into model arrays                          [e2d_inst2mod]
   - Dataset 10: generating photons from the model...                   [s3d_xray_photons]
      o generating 35302 MC photons...
      o generating 23534 MC photons...
      o Total generated =  58836
      o Total kept after NH/arf =  39810     ( 67.66 % )
             10: pass photons through instrument simulation...             [e2d_inst_xray]
             10: load simulation into model arrays                          [e2d_inst2mod]
   - Dataset 11: generating photons from the model...                   [s3d_xray_photons]
      o generating 35302 MC photons...
      o generating 23534 MC photons...
      o Total generated =  58836
      o Total kept after NH/arf =  39876     ( 67.77 % )
             11: pass photons through instrument simulation...             [e2d_inst_xray]
             11: load simulation into model arrays                          [e2d_inst2mod]
   - calculate the figure of merit...                                      [e2d_eval_fom]
      o Data-Model 1,  chi^2 = 3874.71  from 3090 cells;   chi^2/cell = 1.25395;  sum(D)/sum(M) = 1.35471
      o Data-Model 2,  chi^2 = 2273.65  from 2519 cells;   chi^2/cell = 0.902601;  sum(D)/sum(M) = 1.39379
      o Data-Model 10,  chi^2 = 11003.4  from 1543 cells;   chi^2/cell = 7.13119;  sum(D)/sum(M) = 1.38363
      o Data-Model 11,  chi^2 = 2612.35  from 1247 cells;   chi^2/cell = 2.0949;  sum(D)/sum(M) = 1.68123
      o Total FOM = 19764.1
 - - -
hydra>  

Look at the new Data, Model, Residual images for the MEG +1 dataset.
Note that the dispersed model is "blurrier" for the new simulation due to the Doppler effects of the velocity.
hydra> e2d_view_resid(2);                
 - - -
     green indicates  |chi| < 1
 - - -
At Left: Color-coded residual image,
indicating where Data >> Model (red), where Data << Model (blue),
and where Data ~ Model to within statistics (green-black).
(previous model and residual: )
hydra>         

Look at the new imaging residuals for the Sky X,Y dataset; the previous residual is shown again for comparison.
hydra> e2d_view_resid(10);
 - - -
     green indicates  |chi| < 3
 - - -
At Left: Color-coded residual image,
indicating where Data >> Model (red), where Data << Model (blue),
and where Data ~ Model to within statistics (green-black).

Model:
(previous residual: )
hydra>