A small number of functions and classes are included to help organize the data.

For users

class MDAnalysisData.base.Bunch(**kwargs)[source]

Container object for datasets

Dictionary-like object that exposes its keys as attributes.

>>> b = Bunch(a=1, b=2)
>>> b['b']
>>> b.b
>>> b.a = 3
>>> b['a']
>>> b.c = 6
>>> b['c']
MDAnalysisData.base.DEFAULT_DATADIR = '~/MDAnalysis_data'

Default value for the cache directory. It can be changed by setting the environment variable MDANALYSIS_DATA. The current value should be queried with get_data_home().

See also

Managing data.


Return the path of the MDAnalysisData data dir.

This folder is used by some large dataset loaders to avoid downloading the data several times. By default the data dir is set to a folder named ‘MDAnalysis_data’ in the user’s home directory.

Alternatively, it can be set by the MDANALYSIS_DATA environment variable or programmatically by giving an explicit folder path. The ‘~’ symbol is expanded to the user home folder.

If the folder does not already exist, it is automatically created.


data_home (str | None) – The path to MDAnalysisData data dir.


Delete all the content of the data home cache.


data_home (str | None) – The path to MDAnalysisData data dir.

For developers

If you want to add your own dataset then you will likely use these functions in your code.

MDAnalysisData.base.RemoteFileMetadata = <class 'MDAnalysisData.base.RemoteFileMetadata'>

Each remote resource is described by a RemoteFileMetadata, which is a namedtuple() with fields

  • filename: name of the file in the local file system

  • url: full URL for downloading

  • checksum: SHA256 (can be generated with MDAnalysisData.base._sha256(); often it is just as convenient to run the downloader during testing and note the required SHA256 then)


Calculate the sha256 hash of the file at path.

MDAnalysisData.base._fetch_remote(remote, dirname=None)[source]

Helper function to download a remote dataset into path

Fetch a dataset pointed by remote’s url, save into path using remote’s filename and ensure its integrity based on the SHA256 Checksum of the downloaded file.

  • remote (RemoteFileMetadata) – Named tuple containing remote dataset meta information: url, filename and checksum

  • dirname (string) – Directory to save the file to.


file_path – Full path of the created file.

Return type:


MDAnalysisData.base._read_description(filename, description_dir='descr')[source]

Read the description from restructured text file.


filename (str) – name of the description file under the descr directory


All description files are supposed to be stored in the directory description_dir ="descr" that lives in the same directory as the MDAnalysisData.base module file. All descriptions are assumed to be in restructured text format and in UTF-8 encoding.