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


Download files

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

Files for bdata, version 6.1.5
Filename, size File type Python version Upload date Hashes
Filename, size bdata-6.1.5.tar.gz (37.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page