How to use the yt.config.ytcfg.getboolean function in yt

To help you get started, we’ve selected a few yt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yt-project / yt / yt / utilities / answer_testing / View on Github external
def can_run_ds(ds_fn, file_check = False):
    result_storage = AnswerTestingTest.result_storage
    if isinstance(ds_fn, Dataset):
        return result_storage is not None
    path = ytcfg.get("yt", "test_data_dir")
    if not os.path.isdir(path):
        return False
    if file_check:
        return os.path.isfile(os.path.join(path, ds_fn)) and \
            result_storage is not None
    except YTOutputNotIdentified:
        if ytcfg.getboolean("yt", "requires_ds_strict"):
            if result_storage is not None:
                result_storage['tainted'] = True
        return False
    return result_storage is not None
github yt-project / yt / yt / frontends / enzo / View on Github external
def standard_small_simulation(ds_fn, fields):
    if not can_run_ds(ds_fn): return
    dso = [None]
    tolerance = ytcfg.getint("yt", "answer_testing_tolerance")
    bitwise = ytcfg.getboolean("yt", "answer_testing_bitwise")
    for field in fields:
        if bitwise:
            yield GridValuesTest(ds_fn, field)
        if 'particle' in field: continue
        for dobj_name in dso:
            for axis in [0, 1, 2]:
                for weight_field in [None, "Density"]:
                    yield ProjectionValuesTest(
                        ds_fn, axis, field, weight_field,
                        dobj_name, decimals=tolerance)
            yield FieldValuesTest(
                    ds_fn, field, dobj_name, decimals=tolerance)
github yt-project / yt / yt / utilities / View on Github external
def __init__(self):
        self.counters = defaultdict(lambda: 0.0)
        self.counting = defaultdict(lambda: False)
        self.starttime = defaultdict(lambda: 0)
        self.endtime = defaultdict(lambda: 0)
        self._on = ytcfg.getboolean("yt", "timefunctions")
github yt-project / yt / yt / enki / View on Github external
You should have received a copy of the GNU General Public License
  along with this program.  If not, see .

import sys
from yt.logger import enkiLogger as mylog
from yt.config import ytcfg
from yt.arraytypes import *

# Now we import the SWIG enzo interface
# Note that we're going to try super-hard to get the one that's local for the
# user

sp = sys.path

if ytcfg.getboolean("lagos","useswig"):
    if ytcfg.has_option("SWIG", "EnzoInterfacePath"):
        swig_path = ytcfg.get("SWIG","EnzoInterfacePath")"Using %s as path to SWIG Interface", swig_path)
        sys.path = sys.path[:1] + [swig_path] + sys.path[1:] # We want '' to be the first
        import EnzoInterface
        mylog.debug("Imported EnzoInterface successfully")
        has_SWIG = True
    except ImportError, e:
        mylog.warning("EnzoInterface failed to import; all SWIG actions will fail")
        mylog.warning("(%s)", e)
        has_SWIG = False
    has_SWIG = False

sys.path = sp
github yt-project / yt / yt / View on Github external
def get_pbar(title, maxval):
    This returns a progressbar of the most appropriate type, given a *title*
    and a *maxval*.
    maxval = max(maxval, 1)
    from yt.config import ytcfg
    if ytcfg.getboolean("yt", "suppressStreamLogging") or \
       "__IPYTHON__" in dir(__builtin__) or \
       ytcfg.getboolean("yt", "__withintesting"):
        return DummyProgressBar()
    elif ytcfg.getboolean("yt", "__withinreason"):
        from yt.gui.reason.extdirect_repl import ExtProgressBar
        return ExtProgressBar(title, maxval)
    elif ytcfg.getboolean("yt", "__parallel"):
        return ParallelProgressBar(title, maxval)
    widgets = [ title,
            pb.Percentage(), ' ',
            ' ', pb.ETA(), ' ']
    pbar = pb.ProgressBar(widgets=widgets,
    return pbar
github yt-project / yt / yt / analysis_modules / halo_finding / rockstar / View on Github external
def __init__(self, ts, num_readers = 1, num_writers = None,
            outbase="rockstar_halos", particle_type="all",
            force_res=None, total_particles=None, dm_only=False,
            particle_mass=None, min_halo_size=25):
        if is_root():
  "The citation for the Rockstar halo finder can be found at")
        # Decide how we're working.
        if ytcfg.getboolean("yt", "inline") is True:
            self.runner = InlineRunner()
            self.runner = StandardRunner(num_readers, num_writers)
        self.num_readers = self.runner.num_readers
        self.num_writers = self.runner.num_writers"Rockstar is using %d readers and %d writers",
            self.num_readers, self.num_writers)
        # Note that Rockstar does not support subvolumes.
        # We assume that all of the snapshots in the time series
        # use the same domain info as the first snapshots.
        if not isinstance(ts, DatasetSeries):
            ts = DatasetSeries([ts])
        self.ts = ts
        self.particle_type = particle_type
        self.outbase = six.b(outbase)
        self.min_halo_size = min_halo_size
github yt-project / yt / yt / View on Github external
def run_nose(verbose=False, run_answer_tests=False, answer_big_data=False):
    import nose, os, sys
    from yt.config import ytcfg
    nose_argv = sys.argv
    nose_argv += ['--exclude=answer_testing','--detailed-errors']
    if verbose:
    if run_answer_tests:
    if answer_big_data:
    log_suppress = ytcfg.getboolean("yt","suppressStreamLogging")
    ytcfg.set("yt","suppressStreamLogging", 'True')
    initial_dir = os.getcwd()
    yt_file = os.path.abspath(__file__)
    yt_dir = os.path.dirname(yt_file)
        ytcfg.set("yt","suppressStreamLogging", str(log_suppress))
github yt-project / yt / src / lagos / View on Github external
from new import classobj
from string import strip, rstrip
from math import ceil, floor, log10, pi
import os, os.path, types, exceptions, re
from stat import ST_CTIME
import sets

import time

if ytcfg.getboolean("lagos","useswig"):
        from yt.enki import EnzoInterface
    except ImportError:

if ytcfg.getboolean("lagos","usefortran"):
        import EnzoFortranRoutines
    except ImportError:

# Now we import all the subfiles

import PointCombine
from WeaveStrings import *
from EnzoDefs import *
from DerivedFields import *
from DerivedQuantities import quantityInfo
from DataReadingFuncs import *
from ClusterFiles import *
from BaseDataTypes import *
from BaseGridType import *