Skip to main content

nanohub-results

Python library to interact with the NanoHUB Results API. This library provides a Pythonic interface for searching, filtering, and downloading simulation results from NanoHUB tools.

Features

  • Pythonic Query Builder: Fluent interface with method chaining
  • Field Validation: Automatic validation against tool schemas
  • Operation Validation: Only valid operations (=, !=, >, <, >=, <=, like, in)
  • Pagination: Automatic iteration over large result sets
  • Complete API Coverage: Access to all dbexplorer and download endpoints

Installation

cd nanohub-results
pip install .

Quick Start

import nanohubremote as nr
from nanohubresults import Results

# Initialize session with authentication
auth_data = {
    "grant_type": "personal_token",
    "token": "your_token_here"
}
session = nr.Session(auth_data, url="https://nanohub.org/api")
results = Results(session)

# Get list of available tools
tools = results.get_tools(simtool=False)
print(tools)

# Search for results using the Query builder
response = results.query("2dfets") \
    .filter("output.Id", ">", 1e-6) \
    .select("output.Id", "output.Vt") \
    .limit(10) \
    .execute()

print(response)

Available Tools

Some example tools available on NanoHUB:

Rappture Tools:

  • 2dfets - 2D FET I-V characteristics simulator
  • 1dphononbte - 1D Phonon BTE Solver for heat transport
  • abinit - DFT calculations for molecules and periodic solids
  • 1dchainmd - 1D Chain Dispersions
  • 1dfdmht - 1D Finite Different Method Heat Transfer
  • 2dmatstacks - Electrostatic Properties of Layered 2D Materials
  • adept - Solar cell and semiconductor device modeling
  • advte - Advanced Thermoelectric Power Generation

Sim2L Tools:

  • alphafold231 - AlphaFold 2.3.1 protein structure prediction
  • cellrelaxdft - Cell Relax DFT calculations
  • elasticdft - Elastic Constants with DFT
  • gaussianthermo - First-Principles Thermochemical Dataset

Usage Examples

1. List Available Tools

# Get all simulation tools
tools = results.get_tools(simtool=True)
for tool in tools['results']:
    print(f"{tool['tool_name']}: {tool['title']}")

2. Get Tool Schema

# Get detailed schema for a tool
schema = results.get_tool_detail("2dfets")
print(schema)

3. Search with Filters

# Search with multiple filters
query = results.query("1dphononbte") \
    .filter("input.acoustic_length", ">", 1) \
    .filter("output.temperature", ">", 300) \
    .select("input.acoustic_length", "output.temperature", "output.heat_flux") \
    .sort("output.temperature", asc=True) \
    .limit(20)

response = query.execute()

4. Pagination

# Iterate over all results
for result in results.query("abinit") \
        .filter("output.energy", "<", 0) \
        .select("output.energy", "output.forces") \
        .paginate(per_page=50):
    print(result)

5. Download Files

# Download a specific output field
file_content = results.download(
    tool="abinit",
    squid="simulation_id_here",
    field="output.wavefunction"
)

with open("wavefunction.dat", "wb") as f:
    f.write(file_content)

Testing Without Installation

All examples include path configuration for testing without installation:

cd examples
python3 01_basic_search.py

API Reference

Results Class

query(tool, simtool=False)

Create a Query builder for a tool.

get_tools(simtool=False, description_active=False)

Get list of available tools.

get_tool_detail(tool, revision=0, simtool=False)

Get tool schema and metadata.

search(tool, filters, results_fields, ...)

Direct search (or use Query builder).

download(tool, squid, field=None, ...)

Download files or output fields.

Query Class

Methods (all return self for chaining):

  • filter(field, op, value) - Add filter condition
  • select(*fields) - Specify fields to return
  • limit(limit) - Set result limit
  • offset(offset) - Set pagination offset
  • sort(field, asc=True) - Set sort order
  • execute() - Execute the query
  • paginate(per_page=50) - Iterate over all results

Valid Operations

  • = - Equal
  • != - Not equal
  • > - Greater than
  • < - Less than
  • >= - Greater than or equal
  • <= - Less than or equal
  • like - Pattern matching
  • in - In list

Examples Directory

See the examples/ directory for complete examples:

  • 01_basic_search.py - Basic query usage
  • 02_advanced_filtering.py - Multiple filters and sorting
  • 03_downloading_files.py - File downloads
  • 04_pagination.py - Automatic pagination

License

See LICENSE file for details.

Metadata

Release files for nanohub-results 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 nanohub-results 1.0.0
File Size Uploaded Provenance
nanohub_results-1.0.0.tar.gz 29.9 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 43.1 kB

Release files / nanohub_results-1.0.0.tar.gz

Download URL nanohub_results-1.0.0.tar.gz
Size 29.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3ebf324b57666fc3c9260d0d14bebfad4afdcd6a1d175423656ad74240e25ded
BLAKE2b-256 checksum
How to use checksums
f9878544f1c034fd3dc0919ef443ed19607b12affae3cb0a4358af96e055c0b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

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

Download URL nanohub_results-1.0.0-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f3db23d03124a81e62a72657aa9a42f7ab7baeb145fcdc58e3b67c5655af332
BLAKE2b-256 checksum
How to use checksums
330628c509fc6aebfc136bc6cd6c124a361181a620e2b0bf301b30db6b4cd6b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Security for nanohub-results 1.0.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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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