Python SDK for Siroquant API V5
Project description
PYSQ - Siroquant SDK for Python
Python SDK for Siroquant V5 API.
Website: https://www.siroquant.com/
Siroquant is a commercial software package designed for quantitative phase analysis using X-ray diffraction (XRD) data, primarily through the Rietveld refinement method. It enables users to determine the composition of crystalline materials—such as minerals, cements, coals, and clays—by fitting full XRD powder patterns without needing physical standards, making it a standardless technique.
Getting Started
# create a virtual environment and activate it
python -m venv venv
source venv\Scripts\activate
# Install the package
pip install pysq
# Update the package (optional)
pip install --upgrade pysq
Usage Examples
Simple Example
from pysq import SQAPI, SQAPIConfig
config = SQAPIConfig(lib_dir=r".\lib", dll_path=r".\lib\sq_api.dll")
with SQAPI(config) as api:
api.initialize()
task_info = api.open_task("task.tsk")
results = api.refine(task_info.job_handle)
print(f"Results: {results}")
Advanced Example
from pysq import SQAPI, SQAPIConfig, SQAPIError, RefinementParams, ReportResultsFlags, SaveTaskFlags, TaskContext
TASK_FILE = r".\tasks\demo.tsk"
LIB_DIR = r".\lib"
DLL_PATH = r".\lib\sq_api.dll"
def main() -> None:
config = SQAPIConfig(lib_dir=LIB_DIR, dll_path=DLL_PATH)
try:
with SQAPI(config) as api:
api.initialize()
with TaskContext(api, TASK_FILE) as (job_handle, task_info):
print(f"Task: {task_info}")
params = RefinementParams(
n_auto_prescale=1,
n_refs=1,
cutoff=0.5,
error_cutoff=1.0,
error_pc=0.75,
flags=0,
)
results = api.refine(job_handle, params=params, report_flags=ReportResultsFlags.CORRECTED)
print(f"\nResults: {results}")
if results.phases:
print(f"\n{'No.':<4} {'Phase Name':<20} {'Weight (%)':<12} {'Error (%)':<10}")
print("-" * 50)
for i, phase in enumerate(results.phases, 1):
print(f"{i:<4} {phase.phase_name:<20} {phase.weight_pc:<12.2f} {phase.error_of_fit:<10.2f}")
api.save_task(job_handle)
print(f"\nTask saved to: {TASK_FILE}")
except SQAPIError as e:
print(f"\nSQ API Error: {e}")
if e.error_code is not None:
print(f" Code: {e.error_code}")
except Exception as e:
print(f"\nError: {e}")
if __name__ == "__main__":
main()
Configuration
Set paths via environment variables or code:
SQ_LIB_DIR: Library directory pathSQ_DLL_PATH: DLL path (optional, auto-detected)
Requirements
- Python 3.8+
- Windows (x64)
- Siroquant V5
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pysq-0.1.7.tar.gz.
File metadata
- Download URL: pysq-0.1.7.tar.gz
- Upload date:
- Size: 21.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
174d3896589f6d17883724c84eb4f82550b46e2ea0a09becd7d90634a31cea58
|
|
| MD5 |
b9ae6acc30d81677415967e1a465f18a
|
|
| BLAKE2b-256 |
e7e488855a6436c14e42d5b57be743cf2fa94812c02c239fd3909d3822bccbf6
|
Provenance
The following attestation bundles were made for pysq-0.1.7.tar.gz:
Publisher:
publish-pysq.yml on bevolv/sq-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pysq-0.1.7.tar.gz -
Subject digest:
174d3896589f6d17883724c84eb4f82550b46e2ea0a09becd7d90634a31cea58 - Sigstore transparency entry: 1181786647
- Sigstore integration time:
-
Permalink:
bevolv/sq-api@a546e76dafc85a1e43858e7245ba8faa0f90d680 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/bevolv
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pysq.yml@a546e76dafc85a1e43858e7245ba8faa0f90d680 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pysq-0.1.7-py3-none-any.whl.
File metadata
- Download URL: pysq-0.1.7-py3-none-any.whl
- Upload date:
- Size: 22.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5957f3bce4dc65f7cfcdfccb0fac0fcfd23a2719cb2ba470ac69949b7411e0e
|
|
| MD5 |
c2515c03c015d682b4193b02a7e5d798
|
|
| BLAKE2b-256 |
9c58e16b14b644a848a3301f2988e005b1504702dd8423a530e1f6279504523a
|
Provenance
The following attestation bundles were made for pysq-0.1.7-py3-none-any.whl:
Publisher:
publish-pysq.yml on bevolv/sq-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pysq-0.1.7-py3-none-any.whl -
Subject digest:
a5957f3bce4dc65f7cfcdfccb0fac0fcfd23a2719cb2ba470ac69949b7411e0e - Sigstore transparency entry: 1181786648
- Sigstore integration time:
-
Permalink:
bevolv/sq-api@a546e76dafc85a1e43858e7245ba8faa0f90d680 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/bevolv
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pysq.yml@a546e76dafc85a1e43858e7245ba8faa0f90d680 -
Trigger Event:
workflow_dispatch
-
Statement type: