Engineering PapersSearch

SEARCH · Engineering Papers

Results for “Python”

Search indexed NASA NTRS and DOE OSTI research on propulsion, heat transfer, battery materials and energy systems. Follow report and document links to the original sources.

Quote a phrase for an exact phrase match. Source license links do not imply unrestricted reuse.

At least 19 records

Improving Runtime Performance of Tensor Computations using Rust From Python

In this work, we investigate improving the runtime performance of key computational kernels in the Python Tensor Toolbox (pyttb), a package for analyzing tensor data across a wide variety of applications. Recent runtime performance improvements have been demonstrated using Rust, a compiled language, from Python via extension modules leveraging the Python C API—e.g., web applications, data parsing, data validation, etc. Using this same approach, we study the runtime performance of key tensor kernels of increasing complexity, from simple kernels involving sums of products over data accessed through single and nested loops to more advanced tensor multiplication kernels that are key in low-rank tensor decomposition and tensor regression algorithms. In numerical experiments involving synthetically generated tensor data of various sizes and these tensor kernels, we demonstrate consistent improvements in runtime performance when using Rust from Python over 1) using Python alone, 2) using Python and the Numba just-in-time Python compiler (for loop-based kernels), and 3) using the NumPy Python package for scientific computing (for pyttb kernels).

97 MATHEMATICS AND COMPUTING

Flexible Integration of Diverse HVAC Technologies in EnergyPlus via Python-Enabled Workflows

Analysis of advanced controls and novel system types is often not directly feasible in building energy simulation tools. Various techniques extend building energy simulation tool capabilities to allow the use of user-defined scripts and programs, but these approaches have limitations. The EnergyPlus Python plugin offers users new flexibility to use EnergyPlus to call an external Python module at specific points in the simulation, as well as to use Python to call EnergyPlus functionality through an application programming interface (API). This paper presents four case studies leveraging the EnergyPlus Python plugin to facilitate analysis of advanced controls and system types. The use of the Python plugin offers greater modularity and flexibility relative to previous approaches, is less error prone, and is simpler for users to adopt. The Python plugin allows EnergyPlus to be used in a more flexible manner and to accommodate the expanding realm of energy modeling applications.

32 ENERGY CONSERVATION, CONSUMPTION, AND UTILIZATI

Efficient Xml Interchange (exi) For Python (expy)

EXPy provides a native Python interface into the LF Energy EVerest V2G protocol stack. The protocol stack is implemented in C/C++ and compiled into shared object libraries. EXPy provides the Python Ctypes translation of the C/C++ libraries for use with pure Python software. This project eliminates the need for integrating Python with third-party communications applications and greatly reduces the code base and improves performance. The other major benefit is the ability for EXPy to support new EXI based protocols as additional V2G standards are produced (e.g. upgrade from ISO 15118-2 to ISO 15118-20).

Rohde, Kenneth [Idaho National Laboratory (INL), I

PALS Python v0.1.0

This is a Python implementation for the Particle Accelerator Lattice Standard (PALS). To define the PALS schema, Pydantic is used to map to Python objects, perform automatic validation, and serialize/deserialize data classes to/from many modern file formats. Various modern file formats (e.g., YAML, JSON, TOML, XML, etc.) are supported, which makes the implementation of the schema-following files in any modern programming language easy (e.g., Python, Julia, C++, LUA, Javascript, etc.). Here, we do Python.

Huebl, Axel [Lawrence Berkeley National Laboratory

PySolate : A Python‐Based Thresholding Tool to Denoise or Designal Seismic Waveforms Based on the Continuous Wavelet Transform

PySolate is a Python‐based toolset that implements the continuous wavelet transform and nonlinear thresholding operations to denoise or designal seismic data, following Langston and Mousavi (2019). This filtering approach can remove microseismic noise to isolate intermediate‐period seismic signals that are key to enabling full‐waveform modeling and analysis of smaller‐magnitude regional events. This approach is best for the application to signals with frequency or time separation of signal and noise, in contrast to Fourier analysis, which is effective when signal and noise are separated in frequency. We demonstrate the Python toolset using the six announced Democratic People’s Republic of Korea declared nuclear tests, showing the effectiveness of isolating the seismic signal compared to standard bandpass filtering. In conclusion, we also demonstrate the ease of using the toolset with any Python processing tools.

Asia

Validation and Verification of Python based Neutron Spectrum Unfolding Software

To validate and verify the python-based code (PySL), designed to replicate the programs used by STAYSL for Beam Correction Factor (BCF) and Self-Shielding Factor (SHIELD), a series of tests were performed. To test BCF a python script was written to generate a random flux history file and both versions of the code processed the data. The test verified matching values up to at least one decimal place, approximately 10,000 tests where run and each one passed. Isotopes began to fail the tests once neutron saturation was reached. To verify this the total time of exposure was varied the isotopes that failed were compared to a list of their half-lives. The test process for SHIELD was very similar but, in this case, the code began by producing an input file with varying thickness and device type/environment for the SHIELD input. The failure condition for this test was if any of the data points for an isotope had a difference above 3%. Approximately 40 of these tests were run and there were only 3 isotopes that had reoccurring failures but only 2% of their points were above the 3% difference. A visual comparison was conducted by plotting the results from both programs. Although the test failed, the differences between their values were minuscule, and the self-shielding factor’s shape was preserved when plotted. Next steps for this project will be validating and verifying the python-based SigPhi code and then reproducing and testing the least squares unfolding performed by STAYSL.

73 - NUCLEAR PHYSICS AND RADIATION PHYSICS

rcsb-api : Python Toolkit for Streamlining Access to RCSB Protein Data Bank APIs

The Protein Data Bank (PDB) was founded in 1971 as the first open-access digital data resource in biology to serve as the single global archive for three-dimensional (3D) macromolecular structure data. Current PDB holdings exceed 230,000 experimentally determined structures of proteins, nucleic acids, viruses, and macromolecular machines. The RCSB Protein Data Bank RCSB.org research-focused web portal facilitates search, analyses, and visualization of every PDB structure along with more than one million Computed Structure Models from AlphaFold DB and the ModelArchive. It is powered by a set of publicly available Application Programming Interfaces (APIs) that both support RCSB.org users and provide programmatic access to PDB data. Given the breadth and levels of granularity encompassed in this rich data collection, efficiently accessing the information programmatically may be challenging for new users. RCSB PDB has developed a Python software package, rcsb-api , that facilitates easy and efficient use of RCSB PDB APIs within a Python environment. This software tool is designed to streamline access to the extensive corpus of data housed within the PDB, enabling researchers to search, retrieve, and analyze 3D biostructure data seamlessly. Its use will accelerate research in structural biology, molecular biology and biochemistry, drug discovery, and bioinformatics by providing more efficient tools for data integration and analysis. The new toolkit is available on GitHub (github.com/rcsb/py-rcsb-api) and published to the public Python package repository (PyPI) to foster wider usage and support basic and applied research in fundamental biology, biomedicine, and the energy sciences.

FAIR principles

Python Library for Monte Carlo Simulations with Ab Initio and Machine-Learned Interatomic Potentials

There is a growing need in the simulation community for software that provides a transparent, reproducible, usable, and extensible (TRUE) Monte Carlo (MC) simulation framework employing energies from ab initio methods and machine-learning interatomic potentials (MLIPs). We introduce a Python library (ASE-MC) that adds Monte Carlo functionality to the Atomic Simulation Environment (ASE) package. Now, we can combine the powerful tools used to build systems and perform ab initio and MLIP in ASE with MC simulation algorithms to sample the configurational space with a concise Python script. After presenting the design philosophy, we demonstrate the flexibility of our approach using selected examples. These example simulations include liquid water described with a message-passing MLIP in the canonical and isothermal–isobaric ensembles, sampling the characteristic dihedral angle of biphenyl and comparing an MLIP to first-principles calculations, and a grand canonical Monte Carlo simulation of ammonia adsorption on Pt(111). These examples showcase the main features of the software, which include flexibility in the choice of ab initio or MLIP engine, ab initio or MLIP grand canonical MC with cavity bias insertions and deletions, the ability to add custom MC moves to the move set, and how users can condense complex MC workflows into a single Python script. Finally, this library serves as a framework for reproducible Monte Carlo simulations, facilitating easy reproduction of the work and application to new systems.

97 MATHEMATICS AND COMPUTING

Equilipy: a python package for calculating phase equilibria

The CALPHAD (CALculation of PHAse Diagram) approach (Nigel Saunders & Miodownik, 1998) provides predictions for thermodynamically stable phases in multicomponent-multiphase materials across a wide range of temperatures. Consequently, the CALPHAD calculations became an essential tool in materials and process design (Luo, 2015). Such design tasks frequently require navigating a high-dimensional space due to multiple components involved in the system. This increasing complexity demands high-throughput CALPHAD calculations, especially in the rapidly evolving field of alloy design. In response to the need, we developed Equilipy an open-source Python package designed for calculating phase equilibria of multicomponent-multiphase systems. Equilipy is specifically tailored for high-throughput CALPHAD calculations, offering parallel computations across multiple processors and nodes with the given NPT input conditions namely elemental compositions (N), pressure (P), and temperature (T). Equilipy utilizes the program structure and Gibbs energy functions from the Fortran-based program, Thermochimica (Piro et al., 2013), with incorporating a new Gibbs energy minimization algorithm. This algorithm, originally developed by Capitani and Brown in 1987 (Capitani & Brown, 1987), has been revised and implemented to enhance the stability and performance of calculations. The Fortran codes are precompiled and interfaced with Python via F2PY, ensuring high computation speed. Benchmark tests shown in Figure 1 demonstrate that Equilipy’s computation speed is comparable to those of established commercial software, TC-Python and PanPython. This result highlights its efficiency and potential applications in various scientific and industrial fields.

97 MATHEMATICS AND COMPUTING

A Python Tool for Reconstructing MCNP6 Particle Histories from an HDF5 PTRAC File [Slides]

A Python tool for converting the MCNP6 HDF5 PTRAC file to a list of Python trees is presented. The particle trees store MCNP6 simulated events for each history using parent-child relationships, which ensures that branching processes are accurately reproduced. A variety of post-processing scripts are presented and used in conjunction with the Python particle trees to make special tallies that are currently not available in the MCNP6 software and visualize the particle tracks.

97 MATHEMATICS AND COMPUTING

Python-Cubit® Enhancement Scripts: 16.18

The Python-Cubit® enhancement code base is intended to be used as an extension to already existing Cubit® functionality. It provides the user with a number of functionalities that are either currently outside the realm of the python functions which Cubit® supplies internally (such as vector math), or that are comprised of commonly used combinations of already existing python functionalities (such as removing a full round from a slot cut).

97 MATHEMATICS AND COMPUTING

ZERNIPAX: A fast and accurate Zernike polynomial calculator in Python

Zernike polynomials serve as an orthogonal basis on the unit disc, and have proven to be effective in optics simulations, astrophysics, and more recently in plasma simulations. Unlike Bessel functions, Zernike polynomials are inherently finite and smooth at the disc center (r=0), ensuring continuous differentiability along the axis. This property makes them particularly suitable for simulations, requiring no additional handling at the origin. We developed ZERNIPAX, an open-source Python package capable of utilizing CPU/GPUs, leveraging Google's JAX package and available on GitHub as well as the Python software repository PyPI. Furthermore, our implementation of the recursion relation between Jacobi polynomials significantly improves computation time compared to alternative methods by use of parallel computing while still performing more accurately for high-mode numbers.

Astrophysics

bmdrc: Python package for quantifying phenotypes from chemical exposures with benchmark dose modeling

Though chemical exposures are known to potentially have negative impacts on health, including contributing to chronic diseases such as cancer, the quantitative contribution of risk is not fully understood for every chemical. A commonly used approach to quantify levels of risk is to measure the proportion of organisms (such as a total number of zebrafish on a plate or mice in a cage) with abnormal behavioral responses or morphology at increasing concentrations of chemical exposure. A particular challenge with processing the proportional data from these assays is the appropriate estimation of chemical concentration levels that result in malformations or acute toxicity, as these values typically vary between experimental measurements. The recommended approach by the Environmental Protection Agency (EPA) is to fit benchmark dose curves with specific filters and model fitting steps, which are crucial to properly processing the proportional data. Several tools exist for the fitting of benchmark dose response curves, but none are standalone Python libraries built to process both morphological and behavioral data as proportions with all the EPA recommended filters, filter parameters, models, and model parameters. Thus, here we present the benchmark dose response curve (bmdrc) Python library, which was built to closely follow these EPA guidelines with helpful visualizations of filters and fitted model curves, and reports for reproducibility purposes. bmdrc is open-source and has demonstrated utility as a support package to an existing web portal for information on chemicals (https://srp.pnnl.gov). Our package will support any toxicology analysis where the response is a proportional value at increasing levels of a concentration of a chemical or chemical mixture.

Superfund

Automating Log Synthesis and Visualization with Python and Splunk

The goal of this project is to automate log analysis by utilizing Splunk, Bash, and Python together. Simplifying the monitoring and analysis of network traffic was the main goal. In order to accomplish this, a Bash script was created to use 'tcpdump' to automate network sniffing. It also included a 24-hour file rotation mechanism to effectively manage the pcap files that were generated. After that, a Python script was written to read these pcap files and retrieve pertinent data about network traffic. After processing the collected data, Splunk is used to summarize the important metrics and visualize said information with relevant graphs.

99 GENERAL AND MISCELLANEOUS

PYSIMFRAC: A Python library for synthetic fracture generation and analysis

In this paper, we introduce PYSIMFRAC, an open-source python library for generating 3-D synthetic fracture realizations, integrating with fluid simulators, and performing analysis. PYSIMFRAC allows the user to specify one of three fracture generation techniques (Box, Gaussian, or Spectral) and perform statistical analysis including the autocorrelation, moments, and probability density functions of the fracture surfaces and aperture. This analysis and accessibility of a python library allows the user to create realistic fracture realizations and vary properties of interest. In addition, PYSIMFRAC includes integration examples to two different pore-scale simulators and the discrete fracture network simulator, dfnWorks. The capabilities developed in this work provides opportunity for quick and smooth adoption and implementation by the wider scientific community for accurate characterization of fluid transport in geologic media. We present PYSIMFRAC along with integration examples and discuss the ability to extend PYSIMFRAC from a single complex fracture to complex fracture networks.

58 GEOSCIENCES

EPICS for small-scale laboratories with Python soft IOCs

While the Experimental Physics and Industrial Control System (EPICS) is widely used at large laboratories for slow controls and instrumentation, the deployment of a full EPICS installation can be difficult, with a steep learning curve to new users. Taking advantage of the pythonSoftIOC module, we developed an EPICS slow controls implementation for Jefferson Lab's Hall B cryotarget written entirely in Python and based on software IOCs that communicate with instruments over Ethernet. Here, this system ran successfully, interfacing with Jefferson Lab's full EPICS network, and we offer it as an example of the capabilities of pythonSoftIOC to build lightweight, yet robust and flexible instrumentation platforms that would be easily adapted for use at a small-scale laboratory. University groups can use these examples to build complete slow controls systems, from device communication to data archiving and display, using open-source, mature EPICS tools and student-friendly Python as an alternative to expensive and proprietary systems such as LabVIEW.

Computing

ZMPY3D: accelerating protein structure volume analysis through vectorized 3D Zernike moments and Python-based GPU integration

Abstract Motivation Volumetric 3D object analyses are being applied in research fields such as structural bioinformatics, biophysics, and structural biology, with potential integration of artificial intelligence/machine learning (AI/ML) techniques. One such method, 3D Zernike moments, has proven valuable in analyzing protein structures (e.g., protein fold classification, protein–protein interaction analysis, and molecular dynamics simulations). Their compactness and efficiency make them amenable to large-scale analyses. Established methods for deriving 3D Zernike moments, however, can be inefficient, particularly when higher order terms are required, hindering broader applications. As the volume of experimental and computationally-predicted protein structure information continues to increase, structural biology has become a “big data” science requiring more efficient analysis tools. Results This application note presents a Python-based software package, ZMPY3D, to accelerate computation of 3D Zernike moments by vectorizing the mathematical formulae and using graphical processing units (GPUs). The package offers popular GPU-supported libraries such as CuPy and TensorFlow together with NumPy implementations, aiming to improve computational efficiency, adaptability, and flexibility in future algorithm development. The ZMPY3D package can be installed via PyPI, and the source code is available from GitHub. Volumetric-based protein 3D structural similarity scores and transform matrix of superposition functionalities have both been implemented, creating a powerful computational tool that will allow the research community to amalgamate 3D Zernike moments with existing AI/ML tools, to advance research and education in protein structure bioinformatics. Availability and implementation ZMPY3D, implemented in Python, is available on GitHub (https://github.com/tawssie/ZMPY3D) and PyPI, released under the GPL License.

Lai, Jhih-Siang (ORCID:0000000156775890)