pythonyt-project

running python program in yt project with STAMPEDE


I have been working on this python program to find max_dens of my files but whenever I execute the file I get the same error. Can anyone please tell me what these errors refer to? I am using yt 3.1

computes and plots the maximum density over time

    import yt
    #import LibCartesian3D
    import matplotlib
    matplotlib.use('Agg')
    import matplotlib.pyplot as plt
    import glob
    import numpy as np
    flashFolder = '/work/03858/thaque56/run_149/'
    basename = 'super3d_' # sets the prefix of the plotfiles and checkpoint files. Usually 'super3d_' for MHD, 'relax_' for purehydro.
    useAllPlotfiles = False # set True to use glob.glob to select plotfiles (by default uses all available files)
    endcount = 5  # specify if useAllPlotfiles == False, gives the number of the last plotfile which is used

    # ============================ constructs list of filenames if script is run on its own, otherwise supplied by allPlots.py !
    def getfilenames(useAllPlotfiles,endcount):
            if useAllPlotfiles == True:
                    plotFilenames_own = glob.glob(flashFolder + basename + 'hdf5_plt_cnt_[0-9][0-9][0-9][0-9]')
                    plotFilenames_own.sort()
            else:
                    plotFilenames_own = []
                    for n in range(0,endcount + 1):
                            filename = flashFolder + basename + 'hdf5_plt_cnt_%04d' % n
                            plotFilenames_own.append(filename)
            return plotFilenames_own

    #============================

    def main(filenames):
            print 'Executing maxDens.py'

            max_dens = np.zeros(len(filenames))
            time = np.zeros(len(filenames))

            for n in range (len(filenames)):
                    pf =yt.load(filenames[n])
                    time[n] = pf.current_time
                    dens_max, dens_max_location = pf.h.find_max('dens')
                    max_dens[n] = dens_max

            print time, max_dens
            plt.plot(time,max_dens)
            plt.xlabel('time [s]')
            plt.ylabel('density [g/cm^3]')
            plt.title('Maximum Density over Time')
            plt.savefig('MaxDens.png')


    if __name__ == "__main__":
            plotFilenames_own = getfilenames(useAllPlotfiles,endcount)
            main(plotFilenames_own)

I am also attaching the error for you convenience.

>     TACC: Starting up job 6517689
>     TACC: Setting up parallel environment for MVAPICH2+mpispawn.
>     TACC: Starting parallel tasks...
>     Traceback (most recent call last):
>       File "maxDens.py", line 3, in <module>
>         import yt
>       File "/work/03858/thaque56/sw/yt-3.1/yt-x86_64/src/yt-hg/yt/__init__.py",
> line 121, in <module>
>         from yt.data_objects.api import \
>       File "/work/03858/thaque56/sw/yt-3.1/yt-x86_64/src/yt-hg/yt/data_objects/api.py",
> line 51, in <module>
>         from . import construction_data_containers as __cdc
>       File "/work/03858/thaque56/sw/yt-3.1/yt-x86_64/src/yt-hg/yt/data_objects/construction_data_containers.py",
> line 52, in <module>
>         from yt.frontends.stream.api import load_uniform_grid
>       File "/work/03858/thaque56/sw/yt-3.1/yt-x86_64/src/yt-hg/yt/frontends/stream/api.py",
> line 16, in <module>
>         from .data_structures import \
>       File "/work/03858/thaque56/sw/yt-3.1/yt-x86_64/src/yt-hg/yt/frontends/stream/data_structures.py",
> line 38, in <module>
>         from yt.geometry.grid_geometry_handler import \
>       File "/work/03858/thaque56/sw/yt-3.1/yt-x86_64/src/yt-hg/yt/geometry/grid_geometry_handler.py",
> line 38, in <module>
>         from .grid_container import \
>       File "yt/geometry/selection_routines.pxd", line 34, in init yt.geometry.grid_container (yt/geometry/grid_container.c:9108)
>     ValueError: yt.geometry.selection_routines.SelectorObject has the wrong size, try recompiling
>     [c557-601.stampede.tacc.utexas.edu:mpispawn_0][child_handler] MPI

process (rank: 0, pid: 130364) exited with status 1

TACC: MPI job exited with code: 1

TACC: Shutdown complete. Exiting.

Please help me resolve this. i think there is some problem with the yt versions.


Solution

  • The issue is that some of the C extensions yt uses that were generated with cython need to be recompiled. It turns out the clean.sh script doesn't delete those, so you'll have to clean them out like so:

    $ cd /work/03858/thaque56/sw/yt-3.1/yt-x86_64/src/yt-hg/
    $ hg --config extensions.purge= purge --all yt
    $ python setup.py develop
    

    Sorry for giving you bad advice about this on the yt mailing list last night! Hope this fixes things for you.