Re: ISIS problem with match_dataset_grids

From: David P. Huenemoerder <dph_at_email.domain.hidden>
Date: Fri, 29 Sep 2006 11:30:44 -0400
Hi JOy - 

    Joy> Obviously, I've tried to do something that I shouldn't do.
    Joy> Can you give me a clue what I did wrong?  Did I try to regrid
    Joy> too many datasets at once?  Or am I using the command
    Joy> incorrectly.

    isis> [3,4,7,8,11,12,15,16,19,20];
    Joy> Integer_Type[10]
    isis> 
    isis> match_dataset_grids ([3,4,7,8,11,12,15,16,19,20]);
    Joy> *** Malloc Failed:  allocating 32768 bytes
    Joy> *** Error:  rebin failed
    Joy> *** Failed:  rebinning dataset 7
    Joy> S-Lang Error: Intrinsic Error: called from line 3, file: <stdin>
    Joy> //////////////////////////////

You shouldn't run out of memory.  John and I just did a quick test w/
matching 100 spectra, and it used 200MB memory.  What's your system
config? 

 
 
    Joy> All I really want to do is add together the MEG +/- first
    Joy> order from 7 different spectra, and add together the HEG +/-
    Joy> first order from the same spectra.  Then I want to add the
    Joy> combined MEG to the combined HEG.  I have flux-corrected each
    Joy> dataset individually, then combined them.  But I'm sure I
    Joy> need to rebin somewhere.  Do I rebin the individual datasets
    Joy> before combining them, or just before I add the MEG and HEG
    Joy> combined spectra?

OK - here's how I would do that:

Make sure everything is un-grouped.  (matching grids will do whatever
rebinning is required).

 >  group_data(all_data,1);

Match grids of MEG to HEG (picking the higher resolution, so I can
look at HEG resolution later, if I want to).  Assuming, as in your
list only +-1st orders for heg loaded in the order you had:

  1     HETG-ACIS  -1  1   5    8192/ 8192   1   1  3.1000e+01    18.205  HD93129AB
  2     HETG-ACIS   1  1   5    8192/ 8192   2   2  4.1000e+01    18.205  HD93129AB
  3     HETG-ACIS  -1  2   5    8192/ 8192   3   3  6.5000e+01    18.205  HD93129AB
  4     HETG-ACIS   1  2   5    8192/ 8192   4   4  4.1000e+01    18.205  HD93129AB
..
 20     HETG-ACIS   1  2   2    8192/ 8192  20  20  4.6000e+01    19.563  HD93129AB

 > idx_meg = [[3:max(all_data):4], [3:max(all_data):4]+1 ] ;

..assuming that all_data() is what you want - that you haven't loaded
any other data, or have any other orders which you want to ignore.  If
so, just make the idx_meg array explicitly.

Match the MEG grids listed in idx_meg to an HEG grid:

 > match_dataset_grids( [1, idx_meg] ) ; 

Now that they are matched, you can combine them:

 > g = combine_datasets( all_data ) ; 

g is now your group-id.  If you ever forget the members, or need them
in a script, you can use  combination_members( g ) to get the array of
histogram indices:

 > h = combination_members( g );


Now flux correct the combined data on the new grids:

 > flux_corr( all_data ) ; 

Now you can group if you want:

 > group_data( h, 4 ) ; 

and notice, ignore regions:

 > xnotice( h, 6,7);

and when you fit_counts (or fit_flux), isis will sum the data before
computing chisqr (or other statistic), but otherwise properly fold
models through individual responses.  (that is, you didn't have to add
arfs or rmfs to do this, but responses were re-gridded by the
grid-matching). 


Plotting, however, has to be customized, since there aren't any
built-in functions for plotting combined data.  E.g.,


 % plot_data_counts combined:
 define pdcc( gid )
 {
     hplot( get_combined( gid, &get_data_counts ) );
 }

 % plot_model_counts combined:
 define pmcc( gid )
 {
     hplot( get_combined( gid, &get_model_counts ) );
 }

etc (many permutations are possible for counts, flux models,
residuals, overplotting...)  (ask Mike Nowak for his suite of plotting
stuff if you need some - I think he has functions to plot the data and
models individually, but residuals for all the data combined).



Try something like the above and see if it does what you want.  That
doesn't explain why you ran out of memory though --- it would be nice
to understand that, so if you can reproduce it, we'll look into it.

-- Dave

David Huenemoerder  617-253-4283 (o); -253-8084 (f); http://space.mit.edu/home/dph
MIT Kavli Institute for Astrophysics and Space Research
70 Vassar St., NE80-6065,
Cambridge, MA  02139
[Admin. Asst.: Elaine Tirrell, 617-253-7480, egt_at_email.domain.hidden----
You received this message because you are
subscribed to the isis-users list.
To unsubscribe, send a message to
isis-users-request_at_email.domain.hiddenwith the first line of the message as:
unsubscribe
Received on Fri Sep 29 2006 - 12:00:45 EDT

This archive was generated by hypermail 2.3.0 : Fri May 02 2014 - 08:35:44 EDT