Python package for the analysis and visualisation of finite-difference fields.

Overview

discretisedfield

Marijan Beg1,2, Martin Lang2, Samuel Holt3, Ryan A. Pepper4, Hans Fangohr2,5,6

1 Department of Earth Science and Engineering, Imperial College London, London SW7 2AZ, UK
2 Faculty of Engineering and Physical Sciences, University of Southampton, Southampton SO17 1BJ, UK
3 Department of Physics, University of Warwick, Coventry CV4 7AL, UK
4 Research Software Group, University of Birmingham, Birmingham B15 2TT, UK
5 Max Planck Institute for the Structure and Dynamics of Matter, Luruper Chaussee 149, 22761 Hamburg, Germany
6 Center for Free-Electron Laser Science, Luruper Chaussee 149, 22761 Hamburg, Germany

Description Badge
Tests Build status
conda
Releases PyPI version
Anaconda-Server Badge
Coverage codecov
Documentation Documentation
YouTube YouTube
Binder Binder
Platforms Platforms
Downloads Downloads
License License
DOI DOI

About

discretisedfield is a Python package, integrated with Jupyter, providing:

  • definition of finite-difference regions, meshes, lines, and fields,

  • analysis of finite-difference fields,

  • visualisation using matplotlib and k3d, and

  • manipulation of different file types (OVF, VTK, and HDF5).

It is available on Windows, MacOS, and Linux. It requires Python 3.8+.

Documentation

APIs and tutorials are available in the documentation. To access the documentation, use the badge in the table above.

Installation, testing, and upgrade

We recommend installation using conda package manager. Instructions can be found in the documentation.

Binder

This package can be used in the cloud via Binder. To access Binder, use the badge in the table above.

YouTube

YouTube video tutorials are available on the Ubermag channel.

Support

If you require support, have questions, want to report a bug, or want to suggest an improvement, please raise an issue in ubermag/help repository.

Contributions

All contributions are welcome, however small they are. If you would like to contribute, please fork the repository and create a pull request. If you are not sure how to contribute, please contact us by raising an issue in ubermag/help repository, and we are going to help you get started and assist you on the way.

Contributors:

License

Licensed under the BSD 3-Clause "New" or "Revised" License. For details, please refer to the LICENSE file.

How to cite

  1. M. Beg, M. Lang, and H. Fangohr. Ubermag: Towards more effective micromagnetic workflows. IEEE Transactions on Magnetics (2021).

  2. M. Beg, R. A. Pepper, and H. Fangohr. User interfaces for computational science: A domain specific language for OOMMF embedded in Python. AIP Advances 7, 56025 (2017).

  3. Marijan Beg, Martin Lang, Samuel Holt, Ryan A. Pepper, Hans Fangohr. discretisedfield: Python package for the analysis and visualisation of finite-difference fields. DOI: 10.5281/zenodo.3539461 (2021).

Acknowledgements

  • OpenDreamKit – Horizon 2020 European Research Infrastructure project (676541)

  • EPSRC Programme Grant on Skyrmionics (EP/N032128/1)

Comments
  • Add to_xarray as field method

    Add to_xarray as field method

    Adding to_xarray method for Field object which returns field value as an xarray.DataArray.

    1. Typically, the returned DataArray has four dimensions, namely x, y, z, and comp. The first three corresponds to geometry while the fourth dimension corresponds to the components of field. comp dimension has field.components as co-ordinates.
    2. If the Field object is a scalar field, the comp dimension is 'squeezed' and the DataArray has only three dimensions corresponding to the geometry.
    3. Instead of giving fourth dimension (i.e. comp) the name of the field, the name is assigned to the DataArray itself. The default name is 'field', but it can be changed with name parameter.
    4. The units of the field can be set with units parameter. Units of geometry dimensions are set to mesh.attributes['unit'] if the attribute exists, otherwise set to 'm' (meter).
    opened by swapneelap 16
  • Rewrite ovf reading routine

    Rewrite ovf reading routine

    Execution times for 1M cells:

    • Reading
    mode   old    new   speedup
    ==== ======= ====== =======
    bin4 1730 ms  21 ms   82
    bin8 1860 ms  36 ms   52
    text 4920 ms 401 ms   12
    
    • Writing
    mode    old    new   speedup
    ==== ======== ====== =======
    bin4 63000 ms  56 ms   1125
    bin8 64000 ms  84 ms    762
    text 69000 ms 4510 ms    15
    

    Filesizes are

    • 2.9M for bin4
    • 5.8M for bin8
    • 15M for txt
    opened by lang-m 13
  • New initialisation method when passin a `df.Field` using the new xarray functionality.

    New initialisation method when passin a `df.Field` using the new xarray functionality.

    Test

    • field with mesh.n = (100, 100, 10)
    • creation of a new field with mesh.n = (10, 10, 10) and passing the old field to value

    Performance improvement:

    • old implementation (using that the field is callable): ~ 6.5 s
    • new implementation (interpolation done by xarray): ~ 5 ms

    @swapneelap This is probably the first use case for your new method.

    opened by lang-m 10
  • Refactor region

    Refactor region

    @lang-m I've made the initial critical changes we discussed and added tests.

    There are two main issues that I have at the moment that it would be good for you to look at if you have time:

    • [x] Typesystem - as I am not familiar with the type system I've not too sure how to do the correct types for things like units and pmin etc. this is causing some errors in the tests. e.g. allowing complex numbers
    • [x] html representation - this is causing some tests to fail now that I have changed the repr to include pmin and pmax rather than p1 and p2. I don't know all the html code off of the top of my head so I'm hoping it will be a quicker fix for you but let me know if not.
    opened by samjrholt 8
  • On the value of discretisedfield

    On the value of discretisedfield

    Dear Ubermag team, I encountered a problem in simulating a multilayer structure. I don't know what it means to define a three-dimensional value in field. I don't know if I rely on this value and norm=Ms to determine the initial magnetic moment distribution of this material. There is a non-magnetic layer in the multilayer structure that I simulate. How should I define its value for this non-magnetic region? I define the value of field through the following figure function, but when I am creating field, the program reports an error. How can I solve this problem to achieve the desired results? image image

    opened by code-whale 8
  • Mumax view

    Mumax view

    Hi there, Have you considered integrating mumax-view as a tool to visualize 3D fields ? Compared to k3d, it is faster as it is compiled to wasm and has better shaders out of the box. I'm not sure if it's possible to embed it as a notebook widget in a similar way to k3d. Also it would require a few changes to be called through python. I doubt this would be an easy task but k3d can be insanely slow even on top-end workstations ( single-threaded js can only go so far ). I also think mumax-view is a beautifully written software that deserves more attention and it might shine as part of the Ubermag framework.

    opened by MathieuMoalic 7
  • Representation strings.

    Representation strings.

    After merging #86 we have to review __repr__ for Region, Mesh, Field, and FieldRotator. Representation strings are difficult to read because of bad formatting and relatively much information.

    opened by lang-m 5
  • Method returning vector field component as a scalar field

    Method returning vector field component as a scalar field

    Probably the most convenient way for accessing individual components of a vector field is to have a method which returns a scalar field. The question is how this method should be named and called. Maybe

    field.component("x")
    

    Also, we can allow the argument to be 0, 1, 2

    enhancement question 
    opened by marijanbeg 5
  • Copy method in Field class

    Copy method in Field class

    Should Field class be able to set its value with another field like:

    f1 = Field(mesh, dim=3, value=(0, 0, 1))
    f2 = Field(mesh, dim=3)
    
    f2.value = f1
    

    Or f2.value = f1.value is already sufficient?

    enhancement question interface 
    opened by marijanbeg 5
  • Refactor field: vdims

    Refactor field: vdims

    • renamed: dim -> nvdim
    • renamed: components -> vdims
    • removed: coordinate_field
    • removed: typesystem decorator

    Todo

    • [x] check doctests
    • [x] update docstrings
    opened by lang-m 4
  • Automatically determine dtype for array_like inputs.

    Automatically determine dtype for array_like inputs.

    Simplifies array creation and mathematical operations with fields.

    This had been implemented previously but I had initially removed it when rewriting the as_array function.

    Determining the array for callable or dict for value is more complex and therefore not anymore done automatically. Instead, the numpy default (np.float64) is used by default. Furthermore, these types of value only occur during creation by the user where a different dtype can be easily specified (so we don't have any issues with wrong data types during operations on fields).

    opened by lang-m 4
  • Refactor `mesh.allclose` method

    Refactor `mesh.allclose` method

    At present the use of atol and rtol in the method is a bit confusing. Moreover, the method fails if one of the points in the two meshes that are equal to or close to 0.0. We can refactor it to take into account the exponent of the cell dimensions, for example.

    opened by swapneelap 0
Releases(0.65.0)
Owner
ubermag
Computational magnetism tools
ubermag
Python & Julia port of codes in excellent R books

X4DS This repo is a collection of Python & Julia port of codes in the following excellent R books: An Introduction to Statistical Learning (ISLR) Stat

Gitony 5 Jun 21, 2022
trade bot connected to binance API/ websocket.,, include dashboard in plotly dash to visualize trades and balances

Crypto trade bot 1. What it is Trading bot connected to Binance API. This project made for fun. So ... Do not use to trade live before you have backte

G 3 Oct 07, 2022
A GUI for Pandas DataFrames

About Demo Installation Usage Features More Info About PandasGUI is a GUI for viewing, plotting and analyzing Pandas DataFrames. Demo Installation Ins

Adam Rose 2.8k Dec 24, 2022
Graphical visualizer for spectralyze by Lauchmelder23

spectralyze visualizer Graphical visualizer for spectralyze by Lauchmelder23 Install Install matplotlib and ffmpeg. Put ffmpeg.exe in same folder as v

Matthew 1 Dec 21, 2021
Resources for teaching & learning practical data visualization with python.

Practical Data Visualization with Python Overview All views expressed on this site are my own and do not represent the opinions of any entity with whi

Paul Jeffries 98 Sep 24, 2022
Seismic Waveform Inversion Toolbox-1.0

Seismic Waveform Inversion Toolbox (SWIT-1.0)

Haipeng Li 98 Dec 29, 2022
A Simple Flask-Plotly Example for NTU 110-1 DSSI Class

A Simple Flask-Plotly Example for NTU 110-1 DSSI Class Live Demo Prerequisites We will use Flask and Ploty to build a Flask application. If you haven'

Ting Ni Wu 1 Dec 11, 2021
A simple python script using Numpy and Matplotlib library to plot a Mohr's Circle when given a two-dimensional state of stress.

Mohr's Circle Calculator This is a really small personal project done for Department of Civil Engineering, Delhi Technological University (formerly, D

Agyeya Mishra 0 Jul 17, 2021
HM02: Visualizing Interesting Datasets

HM02: Visualizing Interesting Datasets This is a homework assignment for CSCI 40 class at Claremont McKenna College. Go to the project page to learn m

Qiaoling Chen 11 Oct 26, 2021
Missing data visualization module for Python.

missingno Messy datasets? Missing values? missingno provides a small toolset of flexible and easy-to-use missing data visualizations and utilities tha

Aleksey Bilogur 3.4k Dec 29, 2022
High performance, editable, stylable datagrids in jupyter and jupyterlab

An ipywidgets wrapper of regular-table for Jupyter. Examples Two Billion Rows Notebook Click Events Notebook Edit Events Notebook Styling Notebook Pan

J.P. Morgan Chase 75 Dec 15, 2022
Sparkling Pandas

SparklingPandas SparklingPandas aims to make it easy to use the distributed computing power of PySpark to scale your data analysis with Pandas. Sparkl

366 Oct 27, 2022
China and India Population and GDP Visualization

China and India Population and GDP Visualization Historical Population Comparison between India and China This graph shows the population data of Indi

Nicolas De Mello 10 Oct 27, 2021
A small script written in Python3 that generates a visual representation of the Mandelbrot set.

Mandelbrot Set Generator A small script written in Python3 that generates a visual representation of the Mandelbrot set. Abstract The colors in the ou

1 Dec 28, 2021
Design your own matplotlib stylefile interactively

Tired of playing with font sizes and other matplotlib parameters every time you start a new project or write a new plotting function? Want all you plots have the same style? Use matplotlib configurat

yobi byte 207 Dec 08, 2022
Visualization of numerical optimization algorithms

Visualization of numerical optimization algorithms

Zhengxia Zou 46 Dec 01, 2022
Python package that generates hardware pinout diagrams as SVG images

PinOut A Python package that generates hardware pinout diagrams as SVG images. The package is designed to be quite flexible and works well for general

336 Dec 20, 2022
plotly scatterplots which show molecule images on hover!

molplotly Plotly scatterplots which show molecule images on hovering over the datapoints! Required packages: pandas rdkit jupyter_dash ➡️ See example.

150 Dec 28, 2022
🐞 📊 Ladybug extension to generate 2D charts

ladybug-charts Ladybug extension to generate 2D charts. Installation pip install ladybug-charts QuickStart import ladybug_charts API Documentation Loc

Ladybug Tools 3 Dec 30, 2022
An animation engine for explanatory math videos

Powered By: An animation engine for explanatory math videos Hi there, I'm Zheer 👋 I'm a Software Engineer and student!! 🌱 I’m currently learning eve

Zaheer ud Din Faiz 2 Nov 04, 2021