[Gate-users] Unable to use phase space file from IAEA with Gate 6.2

Stathis Kamperis ekamperi at gmail.com
Sat Mar 8 21:34:36 CET 2014


On Sat, Mar 8, 2014 at 10:13 PM, Stathis Kamperis <ekamperi at gmail.com> wrote:
> I'm not sure why Gate can't parse the phase space file. I tried to
> extract the information with Mathematica and it seems that the phase
> space file is ok (not sure about the header though, especially where
> the record contents are declared).
>
> For example I get only 1,2,3 (gammas, e-, e+) for particles:
>
> file =
>   BinaryReadList[
>    "~/Dropbox/foo",
>    Join[
>     Flatten@
>      {"Byte", PadLeft[{}, 6, ToString at Real32], "Integer32", "Integer32"}],
>    ByteOrdering -> -1];
>
> h = HistogramList[file[[All, 1]]]
> {{1, 2, 3, 4}, {1543049, 8306, 161}}
>
> And the ratios seem to be in alignment with what is declared at the header:
>
> First at Last@h/Total at Last@h // N
> 0.994543
>
> 125806703/126491813 // N
> 0.994584
>
> I've only checked 50 MB worth of data but I doubt that there's a wrong
> particle number in the rest (will check though).
>

The whole phase space file is ok. I checked it with the following code snippet:

[stathis at fedora]~/Downloads% cat read.c
                                                     22:32:29
#include <assert.h>
#include <stdio.h>

struct rec {
        char particle;
        char pad[32];
} __attribute__((packed));

int
main(int argc, char *argv[])
{
        FILE *fp;
        struct rec r;
        int cnt, rv;

        fp = fopen(argv[1], "r");
        assert(fp);

        cnt = 0;
        do {
                ++cnt;

                rv = fread(&r, sizeof(struct rec), 1, fp);
                assert(rv > 0 || (rv == 0 && feof(fp)));

                if (r.particle != 1 && r.particle != 2 && r.particle != 3) {
                        printf("Wrong particle = %d at record = %d\n",
                            r.particle, cnt);
                }
        } while(!feof(fp) && !ferror(fp));

        fclose(fp);

        return 0;
}

[stathis at fedora]~/Downloads% gcc -Wall -ansi -pedantic read.c
[stathis at fedora]~/Downloads% ./a.out ELEKTA_PRECISE_6mv_part1.IAEAphsp
[stathis at fedora]~/Downloads%
[stathis at fedora]~/Downloads% echo $?
0
[stathis at fedora]~/Downloads%

> So... has anyone ever successfully used the IAEA phase space files
> with Gate 6.2 ?
>
> Best regards,
> Stathis
>
>
>
>
> On Fri, Mar 7, 2014 at 11:40 PM, Stathis Kamperis <ekamperi at gmail.com> wrote:
>> Relevant:
>>
>> http://comments.gmane.org/gmane.comp.science.opengate.user/3115
>>
>> Best regards,
>> Stathis
>>
>> On Fri, Mar 7, 2014 at 11:26 PM, Stathis Kamperis <ekamperi at gmail.com> wrote:
>>> Greetings everyone,
>>>
>>> I downloaded it from here:
>>> https://www-nds.iaea.org/phsp/photon1/
>>>
>>> ELEKTA_PRECISE_6mv_part1.IAEAphsp and its associated header
>>> ELEKTA_PRECISE_6mv_part1.IAEAheader
>>>
>>> When I try to use it from within Gate with:
>>>
>>> /gate/source/addSource mybeam phaseSpace
>>> /gate/source/mybeam/addPhaseSpaceFile
>>> /home/stathis/Downloads/ELEKTA_PRECISE_6mv_part1.IAEAphsp
>>>
>>> I get the following error:
>>> /home/stathis/Downloads/gate_v6.2/source/physics/src/GateSourcePhaseSpace.cc
>>> (l.252): Source phase space: particle not available in IAEA phase
>>> space format.
>>>
>>> I checked the source code:
>>> http://www.opengatecollaboration.org/lxr/source/6.2.0/source/physics/src/GateSourcePhaseSpace.cc#L231
>>>
>>> and it appears as if Gate can't recognize some particle type that the
>>> header file is including. But,
>>> https://www-nds.iaea.org/phsp/photon1/ELEKTA_PRECISE_6mv_part1.IAEAheader
>>> has only photons, electrons, positrons that Gate should recognize.
>>>
>>> Any thoughts?
>>>
>>> Best regards,
>>> Stathis


More information about the Gate-users mailing list