Skip to main content

This is a python implementation of Hannah & Kontar (2012)’s regularised inversion method. The code is tightly based on the IDL mapping version of the DEM reg-inv code found at https://github.com/ianan/demreg in addition, the code enforces a positivity constraint on the DEM (hence pos).

The philosophy was to produce as similar a piece of software as the original version and as such, this python version has been shown to recover the same DEM as the IDL version (to within approximately 4 significant figures). Since then the code has been significantly optimised and expanded with new features while retaining numerical agreement with the original implementation.

To calculate a DEM you first need:

  • Data and associated error for a range of channels: e.g. in dn/s/px or counts/s

  • Temperature dependent channel response: How sensitive are your channels to plasma of each temperature?

To use: simply call dn2dem with either a single pixel, 1d slice, 2d map, or 3d map-timeseries of DN values as a function of filter (and associated error on DN), an array of temperatures over which to perform the DEM analysis and a temperature response for those filters.

For large datasets, beyond 200 pixels, the code switches to a parallel execution providing significant speedups.

Usage of Generative AI

We expect authentic engagement in our community. Be wary of posting output from Large Language Models or similar generative AI as comments on GitHub or any other platform, as such comments tend to be formulaic and low quality content. If you use generative AI tools as an aid in developing code or documentation changes, ensure that you fully understand the proposed changes and can explain why they are the correct approach and an improvement to the current state.

License

This project is Copyright (c) Alasdair Wilson and licensed under the terms of the MIT license. This package is based upon the Openastronomy packaging guide which is licensed under the BSD 3-clause licence. See the license files for more information.

Contributing

We love contributions! demregpy is open source, built on open source, and we’d love to have you hang out in our community.

Imposter syndrome disclaimer: We want your help. No, really.

There may be a little voice inside your head that is telling you that you’re not ready to be an open source contributor; that your skills aren’t nearly good enough to contribute. What could you possibly offer a project like this one?

We assure you - the little voice in your head is wrong. If you can write code at all, you can contribute code to open source. Contributing to open source projects is a fantastic way to advance one’s coding skills. Writing perfect code isn’t the measure of a good developer (that would disqualify all of us!); it’s trying to create something, making mistakes, and learning from those mistakes. That’s how we all improve, and we are happy to help others learn.

Being an open source contributor doesn’t just mean writing code, either. You can help out by writing documentation, tests, or even giving feedback about the project (and yes - that includes giving feedback about the contribution process). Some of these contributions may be the most valuable to the project as a whole, because you’re coming to the project with fresh eyes, so you can see the errors and assumptions that seasoned contributors have glossed over.

Note: This disclaimer was originally written by Adrienne Lowe for a PyCon talk, and was adapted by demregpy based on its use in the README file for the MetPy project.

Metadata

Release files for demregpy 1.0.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 demregpy 1.0.0
File Size Uploaded
demregpy-1.0.0.tar.gz 12.7 MB Details

Built distribution (wheel)

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

Total release size: 25.6 MB

Release files / demregpy-1.0.0.tar.gz

Download URL demregpy-1.0.0.tar.gz
Size 12.7 MB
Tags Source
SHA-256 checksum
How to use checksums
b65e40987d512860bfcc7837c8d4ff7f7c3e2af33542af4da42f5a1c5ee40b31
BLAKE2b-256 checksum
How to use checksums
157f6efb3a0efc2d2c16aadd64259cde46913ef7a289d1b0ae94195a6cb46fc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 15, 2026.

Transparency log

Release files / demregpy-1.0.0-py3-none-any.whl

Download URL demregpy-1.0.0-py3-none-any.whl
Size 12.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
f3e7f8884a7e69768aa5a60bc30418027475adca6b3291063df53b9772acfb0f
BLAKE2b-256 checksum
How to use checksums
5657708778cd895d0de357f137a0333722f72ace9bd3324c216b1ac12a7c95f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.6.2

1 release file

0.6.1

1 release file

0.6

1 release file

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