Skip to main content

A header generator and FITS file creator for DKIST data.

Project description

A header generator and FITS file creator for DKIST data

This package is designed to generate sets of FITS files which represent DKIST level 0 and level 1 data. These generated data should not be considered as a promise of what will be delivered when real data is obtained, these products are still a work in progress.

Using

Generating Pesudo Random Data

The simplest way to generate data is to to use the dkist_data_simulator.spec122.Spec122Dataset or dkist_data_simulator.spec214.Spec214Dataset classes.

To generate a header:

>>> from dkist_data_simulator.spec122 import Spec122Dataset
>>> ds = Spec122Dataset(dataset_shape=(1, 512, 512), array_shape=(1, 512, 512), time_delta=10)
>>> ds.header()

A complete list of headers for all frames in the dataset can be generated with the generate_headers method.

It is also possible to iterate over a dataset, this changes the .index property.

This can be used to generate a sequence of headers one at a time:

>>> header_generator = (d.header() for d in ds)

It can also be used to generate files in memory:

>>> import io
>>> file_generator = (d.file(io.BytesIO()) for d in ds)

Customising the Generated Data

To customise the data being generated, subclass a dataset. To add new headers, either the add_constant_key method, or the add_generator_function methods can be used in the constructor. Also a shorthand way of having a function generate key values is to use the dkist_data_simulator.dataset.key_function decorator.

>>> from dkist_data_simulator.dataset import key_function
>>> from dkist_data_simulator.spec122 import Spec122Dataset
>>> class ExampleDataset(Spec122Dataset):
...     def __init__(self, *args, **kwargs):
...         super().__init__(*args, **kwargs)
...         # Add a header key with a given, fixed value over all headers
...         self.add_constant_key("INSTRUME", "Example")
...         # Add a header key with a given, single random value over all headers
...         self.add_constant_key("EXPER_ID")
...
...     @key_function("FRAMEVOL")
...     def framevol(self, key):
...         return 10

To remove a key from a generated header (for instance to generate invalid data), overload the header() method and remove keys before returning:

>>> class InvalidDataset(Spec122Dataset):
...     def header(self, *args, **kwargs):
...         header = super().header(*args, **kwargs)
...         header.pop("NAXIS")
...         return header

License

This project is Copyright (c) AURA / NSO and licensed under the terms of the BSD 3-Clause license. This package is based upon the Openastronomy packaging guide which is licensed under the BSD 3-clause licence. See the licenses folder for more information.

Contributing

We love contributions! dkist-data-simulator 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 dkist-data-simulator based on its use in the README file for the MetPy project.

Project details


Release history Release notifications | RSS feed

This version

1.1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dkist_data_simulator-1.1.0.tar.gz (31.2 kB view details)

Uploaded Source

Built Distribution

dkist_data_simulator-1.1.0-py3-none-any.whl (32.0 kB view details)

Uploaded Python 3

File details

Details for the file dkist_data_simulator-1.1.0.tar.gz.

File metadata

  • Download URL: dkist_data_simulator-1.1.0.tar.gz
  • Upload date:
  • Size: 31.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6

File hashes

Hashes for dkist_data_simulator-1.1.0.tar.gz
Algorithm Hash digest
SHA256 a69fa42a9dcaf8e4877407335ff13650e66b2877211b999f517d30f5d4e22be8
MD5 511d3a5a87ffdb202b053d4606754763
BLAKE2b-256 65d623f79c19992d65ea7fbdb3dab2f9a8473d82a79d56c696c793cb02a0bbd1

See more details on using hashes here.

Provenance

File details

Details for the file dkist_data_simulator-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: dkist_data_simulator-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 32.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6

File hashes

Hashes for dkist_data_simulator-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8279b07693068f4df66847094472cf3da4a071ef06a9f3e4fc88e4e78f925f2b
MD5 ae44147c9137bc9a5135cf8d50e5ae90
BLAKE2b-256 8eee4d90f091a597fd26dcc87aca9c5540fe1c8f35aecf83e8619c2ed9659fd0

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page