Skip to main content

Package to access nuclear density files

Project description

NUCDENS

Library for online accessing, reading and writing Compton densities.

When using the data files or software, please cite the original work:

H.~W.~Griesshammer, J.~A.~McGovern, A.~Nogga and D.~R.~Phillips, ``Scattering Observables from One- and Two-Body Densities: Formalism and Application to $\gamma,{}^3$He Scattering,'' Few Body Syst. \textbf{61} (2020) no.4, 48 doi:10.1007/s00601-020-01578-w [arXiv:2005.12207 [nucl-th]].

Installation

The source code and examples are available at https://jugit.fz-juelich.de/a.nogga/nucdensity.

The easiest way to install is using git clone and pip:

git clone git clone https://jugit.fz-juelich.de/a.nogga/nucdensity.git 
cd nucdensity
pip install -e .  

Usage

The package provides an interface to download the data files from our repository and to read the files and test. More advanced options will be documented later. Jupyter notebook testing the access can be found in tests. Some examples are in examples.

For downloading specific files to a local directory, e.g., $HOME/work/denstest use

from nucdens import access
testdf=access.database(workdir=os.environ["HOME"]+"/work/denstest")

This downloads a pandas dataframe with the available density files and stores it into testdf . The pandas dataframe can be printed using

import pandas as pd  
pd.set_option('display.max_columns', None)
print(testdf.pddf)

Downloading density files of, e.g., row 36 and 4 of the table is done by

import os 
# get file info from table 
row=testdf.pddf.loc[[36]]
densid=row.to_dict('records')[0]
# retrieve file
hashname,uniquename=testdf.get_file(**densid)
# print name and file size 
print("hashname:    ",hashname)
print("filesize:    ",os.path.getsize(hashname))
print("uniquename:  ",uniquename)

The files are downloaded and gunzipped. They are partly also compressed using the ZFP compressors (see https://github.com/LLNL/zfp). Using the files might require to install the corresponding HDF plugins (https://github.com/LLNL/H5Z-ZFP). The local files will be first stored under their hashname. However, the python method also returns a suggestion for a unique file name uniquename that includes the parameters of the file. If wanted, users may rename the file using the provided uniquename.

The file from the example is two-body density. You can read in and get some basic properties using the densfile2b constructor

density2b=access.densfile2b(hashname,printlevel=1)

One-body densities can be tested similarly using the densfile1b constructor

density1b=access.densfile1b(hashname,printlevel=1)

Project details


Download files

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

Source Distribution

nucdens-1.2.0.tar.gz (8.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nucdens-1.2.0-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

Details for the file nucdens-1.2.0.tar.gz.

File metadata

  • Download URL: nucdens-1.2.0.tar.gz
  • Upload date:
  • Size: 8.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for nucdens-1.2.0.tar.gz
Algorithm Hash digest
SHA256 8614052eb10ab7c8ddf2616044aec24ed23d4a0b2f99a72c7fbabc23cd46fa46
MD5 39d88f40a3feef761bf880d085b7e488
BLAKE2b-256 f7015908a8bacf2bb5dbf8069bde483b2c016b983ab29d4a5c8da19e2e9f54b6

See more details on using hashes here.

File details

Details for the file nucdens-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: nucdens-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 24.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for nucdens-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09411a06ad8b0a75953b00ec8bd9f2479d1cd5519a6386cad9c5d6efbe145948
MD5 01720fa0e5439906fd7ed7d54ac2d9e9
BLAKE2b-256 950633acff6c87559abef9ccc11693d8007e009dbd2b6e78ee0d2a2ff10bd192

See more details on using hashes here.

Supported by

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