Python CLI Steps Explained



This page details the steps that are performed when a QAMgr object is created and its .run() method is called. You should not need to run these steps individually unless you are experiencing errors.

Setup

from qamgr import *

This loads the qamgr package.
Note: The first time you import qamgr after installing or updating on Windows, you may see some warnings about escape sequences. These can be safely ignored.


Creating the QAMgr Object

You can specify a DICOM RTPLAN file manually by either typing or pasting it in place of <FILENAME>:

q = QAMgr('<FILENAME>')

Alternately, you can choose from a list of files by simply creating the QAMgr object without and argument:

q = QAMgr()

In either case, calling the QAMgr constructor prompts the user for their initials, then loads the DICOM file and extracts the needed information.
It also prints some basic information about what it found in the DICOM file; you can see this information again at any time by calling q.info().


PROGRESS MARKER


Primary Functions

You should (hopefully) only need a few commands for basic analysis while running.
These are QAMgr.show_record(), QAMgr.profile(), and QAMgr.save_profile().
For conveniently scrolling through the entries, there is also a pair of functions QAMgr.show_next_record() and QAMgr.show_prev_record().


Plotting and Saving the Overall Pulse-Charge Profile

q.profile()

This function shows the distribution of all the delivery records in the log file, for PulseCount indices 0–1500.

q.save_profile()

This function simply saves the profile plot as a .png file, using the name of the original log file as a base.


Scrolling Through Delivery Records

q.show_record(<RECORD_NUMBER>)      # show a specific delivery record
# and
q.show_next_record()                # scroll through records in order
q.show_prev_record()                # scroll through records in order

This is probably the (currently) most-usefule feature; it prints relevant parameters for a given delivery record and displays a plot of Doseplane_pC vs Timestamp_us.
These will probably be your best friends.
For a typical workflow, call q.show_next_record(), then just keep pressing <up> and <Enter>.
Note: As of v0.9.0, QAMgr will automatically check for and import any new data from the logfile if you call show_next_record() while on the final record.


Object Summaries

You can print summary information at any time using the .info() method, which is shared by the main object flashlogs.QAMgr, its child flashlogs.DeliveryRecord, and the delivery record’s child pandas.DataFrame (which contains that record’s data table of pulse measurements).
These can be accessed as follows (replace “0” with your choice of file and delivery record):

from flashlogs import *                 # import module(s)
la = QAMgr(get_logfile_name(0)) # create QAMgr object and run analysis
q.info()                                # print summary for QAMgr
dr = q.get_delivery_record(0)           # retrieve DeliveryRecord object
dr.info()                               # print summary for the chosen delivery record
df = dr.pulses                          # retrieve pulse data table, which is a PANDAS DataFrame object
df.info()                               # print summary for pulse data table


<– Prev || Contents || Next –>