defaults.rst 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. .. _defaults:
  2. -----------------------------
  3. Defaults for bcolz operation
  4. -----------------------------
  5. You can tailor the behaviour of bcolz by changing the values of
  6. certain some special top level variables whose defaults are listed
  7. here. You can change these values in two ways:
  8. * In your program: the changes will be temporary. For example::
  9. bcolz.defaults.out_flavor = "numpy"
  10. * Manually modify the ``defaults.py`` module of the bcolz package: the
  11. changes will be persistent. For example, replace::
  12. defaults.out_flavor = "bcolz"
  13. by::
  14. defaults.out_flavor = "numpy"
  15. Generally, only the former is needed.
  16. Defaults in contexts
  17. ====================
  18. bcolz allows to set short-lived defaults in contexts. For example::
  19. with bcolz.defaults_ctx(vm="python", cparams=bcolz.cparams(clevel=0)):
  20. cout = bcolz.eval("(x + 1) < 0")
  21. means that the `bcolz.eval` operation will be made using a "python"
  22. virtual machine and no compression for the `cout` output.
  23. List of default values
  24. ======================
  25. .. py:attribute:: out_flavor
  26. The flavor for the output object in :py:func:`eval` and others
  27. that call this indirectly. It can be 'bcolz' or 'numpy'. Default
  28. is 'bcolz'.
  29. .. py:attribute:: vm
  30. The virtual machine to be used in computations (via
  31. :py:func:`eval`). It can be 'python', 'numexpr' or 'dask'.
  32. Default is 'numexpr', if installed. If not, 'dask' is used, if
  33. installed. And if neither of these are installed, then the
  34. 'python' interpreter is used (via numpy).
  35. .. py:attribute:: cparams
  36. :noindex:
  37. The defaults for parameters used in compression (dict). The
  38. default is {'clevel': 5, 'shuffle': True, 'cname': 'lz4',
  39. quantize: 0}.
  40. See Also:
  41. :py:func:`cparams.setdefaults`