File: python-api.rst

package info (click to toggle)
python-gsd 3.4.2-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,020 kB
  • sloc: python: 3,141; ansic: 2,057; cpp: 120; makefile: 16
file content (47 lines) | stat: -rw-r--r-- 1,217 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
.. Copyright (c) 2016-2024 The Regents of the University of Michigan
.. Part of GSD, released under the BSD 2-Clause License.

gsd Python package
==================

**GSD** provides a **Python** API. Use the `gsd.hoomd` module to read and write files for
HOOMD-blue.

Submodules
----------

.. toctree::
   :maxdepth: 1

   python-module-gsd.fl
   python-module-gsd.hoomd
   python-module-gsd.pygsd
   python-module-gsd.version

Package contents
----------------

.. automodule:: gsd
    :synopsis: GSD main module.
    :members:

Logging
-------

All Python modules in **GSD** use the Python standard library module :py:mod:`logging` to log
events. Use this module to control the verbosity and output destination::

    import logging
    logging.basicConfig(level=logging.INFO)

.. seealso::

    Module :py:mod:`logging`
        Documentation of the :py:mod:`logging` standard module.

Signal handling
---------------

On import, `gsd` installs a ``SIGTERM`` signal handler that calls `sys.exit` so that open gsd files
have a chance to flush write buffers (`GSDFile.flush`) when a user's process is terminated. Use
`signal.signal` to adjust this behavior as needed.