Skip to main content

BNMR/BNQR MUD file reader and asymmetry calculator

Project description

Package Overview

Beta-data package.

Setup

Dependencies needed pre-install:

  • python development version: sudo apt-get install python3-dev (on Ubuntu, for example)

Install

  • Install using pip: pip3 install bdata

Optional Configuration

  • For bdata: Export the following environment variables to set the local data storage location (add to .bashrc): Set BNMR_ARCHIVE and BNQR_ARCHIVE the following scheme points to the msr files:
       ${BNMR_ARCHIVE}/year/filename.msr
       ${BNQR_ARCHIVE}/year/filename.msr
    
    By default bdata will look for data in $HOME/.bdata/. If the requested run is not found locally, an attempt to downlaod the file from musr.ca will ensue. The file will be written to disk at the appropriate location.

Contents

  • bdata [object]: access BNMR MUD files
  • bjoined [object]: append bdata objects
  • bmerged [object]: combine bdata objects
  • life [mdict object]: dictionary of probe lifetimes.

bdata

Beta-data object, inherits from mdata. The bdata object is a data container with some basic analysis capabilities, designed to read out MUD data files and to provide user-friendly access to the file headers and provide asymmetry calculations.

Object Map

Signature:

bdata(run_number,year=None,filename='')

Examples:

b = bdata(40001)                     # read run 40001 from the current year. 
b = bdata(40001,year=2017)           # read run 40001 from year 2017.
b = bdata(0,filename='filename.msr') # read file from local memory, run number unused 

Functions:

Signature Description
asym(option="",omit="",rebin=1,hist_select='',nbm=False) Calculate asymmetry.
beam_kev(get_error=False) Get beam implantation energy in keV
get_pulse_s() Get beam pulse duration in s

Misc Features

In addition to those provided by mdata.

Special Rules For Attributes

If an attribute is not found in bdata, it will look for the attribute in the mdict objects in the order: camp, epics, ppg, hist. This second-level attribute search is much slower than regular access.

bjoined

Object for appending bdata objects. Attribute access works through lists (see examples below). Histogram counts are summed over to emulate data taken within a single run. bdata asymmetry calculations operate on these summed histograms. Additional functionality for proper weighted means of asymmetries of the invididual runs is also given.

Object Map

Signature:

bjoined(bdata_list)

Examples:

blist = [bdata(r,year=2019) for r in range(40010,40013)] # read runs 40010-40012
bjnd = bjoined(blist)                                    # combine these runs

Functions:

In addtion to the bdata functions, bjoined also provides:

Signature Description
asym_mean(*asym_args,**asym_kwargs) Take weighted mean of individual asymmetries. Arguments are passed to bdata.asym()

Misc Features

Special Rules For Attributes and Lists

Attribute access passes through list objects. For example, if we have created the bjnd object from the previous example, we run

bjnd.camp

we get a list of mdict objects. We can access the magnetic field strength as follows:

bjnd.camp.b_field

or a list of the mean values:

bjnd.camp.b_field.mean

despite the fact that at each stage a list is returned. Attribute lookup is treated the same as in bdata so that the above could be shortened to

 bjnd.b_field.mean

with some small penalty to run time.

bmerged

Object for combining bdata objects. Unlike bjoined, bmerged should look and behave more or less identically to the bdata object. In this way, runs can be combined and replaced in existing code with little modification. Histograms are combined in the same was as bjoined: counts are summed over to emulate data taken within a single run. bdata asymmetry calculations operate on these summed histograms.

Object Map

Signature:

bmerged(bdata_list)

Examples:

blist = [bdata(r,year=2019) for r in range(40010,40013)] # read runs 40010-40012
bjnd = bmerged(blist)                                    # combine these runs

life

Probe lifetimes. Example:

import bdata as bd
lifeitme = bd.life.Li8
error = bd.life.Li8_err

Probes implemented are keyed by Li8, Li9, Be11, F20, Mg31, Ac230, Ac234.

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

bdata-6.1.4.tar.gz (37.0 kB view details)

Uploaded Source

File details

Details for the file bdata-6.1.4.tar.gz.

File metadata

  • Download URL: bdata-6.1.4.tar.gz
  • Upload date:
  • Size: 37.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.4.2 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.8.0 tqdm/4.51.0 CPython/3.6.9

File hashes

Hashes for bdata-6.1.4.tar.gz
Algorithm Hash digest
SHA256 2e2a71f178ccfecee13bfa4a0fb8c06019b3cc697dad7b52022f21ef00bbc4e6
MD5 33be7a7599dd05610573b17f0612e220
BLAKE2b-256 1d7ad343d344a8cca17c1c8cf5b4236276e71ef84d7cdc2a8d4b38fc2c2c5b85

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