semvec/pypi-packages huggingface dataset:
variational 0.6.0
Variational Reference SDK
Requires Python: >=3.11

# Variational SDK for Python 

> [!NOTE]
> API key generation is currently unavailable. Please contact our team via hello@variational.io if you are interested in using the API service. 

## Documentation

https://docs.variational.io/for-developers/api

## Quickstart

### 1. Create API credentials

Navigate to the API settings page at https://testnet.variational.io/app/settings

<img width="1033" alt="Variational / Settings / API" src="https://github.com/variational-research/variational-sdk-python/assets/155017661/b2cb472b-7742-4c74-9836-12dee28dcfb8">

Add a descriptive label, create your key, and make sure to save the secret as it's only displayed once.

### 2. Install Python SDK

```
pip install variational
```

### 3. Make some requests!

```python
from variational import Client, TESTNET
from pprint import pprint

# FIXME: load from environment variables
API_KEY = "your-api-key"
API_SECRET = "your-api-secret"

client = Client(API_KEY, API_SECRET, base_url=TESTNET)
summary = client.get_portfolio_summary().result
pprint(summary)
```

**Client parameters:**
 - `key`: str (required) — your API key
 - `secret`: str (required) — your API secret
 - `base_url`: str (optional) — prefix of Variational API endpoints
 - `request_timeout`: float (default=None) — timeout for individual HTTP requests
 - `retry_rate_limits`: bool (default=True) — enables automatic retry on HTTP 429 errors


### 4. Explore

Visit [Endpoint Reference](https://docs.variational.io/for-developers/api/endpoints) to learn which API calls are supported.

Read about the [Pagination](https://docs.variational.io/for-developers/api/pagination) mechanism used by Variational API.

Learn how [Rate Limits](https://docs.variational.io/for-developers/api/rate-limits) and [Authentication](https://docs.variational.io/for-developers/api/authentication) are applied to your calls.
dm4 1.0.3
A Digital Micrograph 4 (DM4) file reader.

###
dm4
###

A pure python file reader for Digital Micrograph's DM4 file format

This package would not have been possible without the documentation provided by Dr Chris Boothroyd at http://www.er-c.org/cbb/info/dmformat/ Thank you.

############
Installation
############

Install using pip from the command line::

   pip install dm4

#######
Example
#######
   
Below is a short example of reading the image data from a dm4 file.  A more complete example can be found in the tests.::

   import dm4
   import PIL

   input_path = "your_filename_here.dm4"

   with dm4.DM4File.open(input_path) as dm4file:
       tags = dm4file.read_directory()

       image_data_tag = tags.named_subdirs['ImageList'].unnamed_subdirs[1].named_subdirs['ImageData']
       image_tag = image_data_tag.named_tags['Data']

       XDim = dm4file.read_tag_data(image_data_tag.named_subdirs['Dimensions'].unnamed_tags[0])
       YDim = dm4file.read_tag_data(image_data_tag.named_subdirs['Dimensions'].unnamed_tags[1])

       image_array = np.array(dm4file.read_tag_data(image_tag), dtype=np.uint16)
       image_array = np.reshape(image_array, (YDim, XDim))

       output_fullpath = "sample.tif"
       image = PIL.Image.fromarray(image_array, 'I;16')
       image.save(output_fullpath)

############
Script usage
############

The dm4 module can be invoked as a script to print a dm4 file's full directory to the command line.  This is helpful when determining the exact structure of a specific DM4 file: ::

    python -m dm4 your_dm4_file.dm4


####
Todo
####

Reading arrays of groups has not been implemented.