Skip to main content

blobmodel

Python version Pypi codecov Tests Checked with mypy Code style: black License: MIT Documentation Status

This package provides realizations of advecting and dissipating blobs in up to two dimensions.

All blob parameters can be choosen freely, and multiple blob shapes are implemented. Originally, the model is developed for studying the scrape-off layer of fusion experiments, but it can be applicable to many 1d or 2d systems. See the blobmodel documentation for further details.

Examples for one and two dimensions are shown below:

1D 2D
Density evolution Density evolution

Installation

The package is published to PyPI and can be installed with

pip install blobmodel

If you want the development version you must first clone the repo to your local machine, then install the project in development mode:

git clone https://github.com/uit-cosmo/blobmodel.git
cd blobmodel
python -m pip install -e .

Usage

Create a grid on which the blobs are discretized using the Model class. The make_realization() method computes the output as an xarray dataset which can also be written out as a netcdf file if the argument file_name is specified. A simple example is shown below:

from blobmodel import Geometry, Model, show_model

bm = Model(
    geometry=Geometry(Nx=200, Ny=100, Lx=10, Ly=10, dt=0.1, T=20), num_blobs=100
)

ds = bm.make_realization(file_name="example.nc")

The data can be shown as an animation using the show_model function:

show_model(ds)

You can specify the blob parameters with a BlobFactory class. The DefaultBlobFactory class has some of the most common distribution functions implemented. An example would look like this:

from blobmodel import DefaultBlobFactory, DistributionEnum, Geometry, Model

# use DefaultBlobFactory to define distribution functions of random variables
my_blob_factory = DefaultBlobFactory(t_drain=100).set_sampler(
    "amplitude", DistributionEnum.normal, free_parameter=5
)

# pass on my_blob_factory when creating the Model
bm = Model(
        geometry=Geometry(Nx=100, Ny=100, Lx=10, Ly=10, dt=0.1, T=20),
        blob_factory=my_blob_factory,
        num_blobs=100,
    )

Alternatively, you can specify all blob parameters exactly as you want by writing your own class which inherits from BlobFactory. See examples/custom_blobfactory.py as an example or take a look at the blobmodel documentation.

Blobs can decay exponentially from their initial time with a drainage time t_drain, and/or be given a finite pulse lifetime t_lifetime, a Gaussian envelope symmetric about the blob's t_init so that the blob grows, peaks and decays. Both are arguments of DefaultBlobFactory and are applied to every sampled blob; see the drainage time and pulse lifetime sections of the documentation.

Contributing

Feel free to raise issues about anything. Contributions through pull requests are also very welcome. Please take a look at our Contributor guide for further details.

Metadata

Release files for blobmodel 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for blobmodel 2.1.0
File Size Uploaded Provenance Actions
blobmodel-2.1.0.tar.gz 55.3 kB Without provenance Details for blobmodel-2.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for blobmodel 2.1.0
File Interpreter ABI Platform Actions
blobmodel-2.1.0-py3-none-any.whl Python 3 none any Details for blobmodel-2.1.0-py3-none-any.whl

Total release size: 85.1 kB

Release files / blobmodel-2.1.0.tar.gz

Download URL blobmodel-2.1.0.tar.gz
Size 55.3 kB
Tags Source
SHA-256 checksum
How to use checksums
80bd1cde415a6d90961e1c8dfc813f9ff6983b7113ff5488516f18aaae7f73aa
BLAKE2b-256 checksum
How to use checksums
bbd4c500249e7ee9d7ebf848c25f0f644cad4684f2688f8ba7d4e8cb48fe9e02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Release files / blobmodel-2.1.0-py3-none-any.whl

Download URL blobmodel-2.1.0-py3-none-any.whl
Size 29.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
185e392931f10058c8c68f1da3ade902cb5a0145d193afac3eb013d83ebe048a
BLAKE2b-256 checksum
How to use checksums
b7110ebd907c21f86dd479e084da65e49029413a54d5abf0e45394efd887afc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Security for blobmodel 2.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page