Python CLI Steps Explained {#pyexpl}
==============================================================

---

---

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
```python
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 ``:
```python
q = QAMgr('')
```
Alternately, you can choose from a list of files by simply creating the QAMgr object without and argument:
```python
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
```python
q.profile()
```
This function shows the distribution of all the delivery records in the log file,
  for `PulseCount` indices 0--1500.
```python
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
```python
q.show_record()		# 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 `` and ``.
***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 {#objsum}

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):
```python
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
```

---

---

[](GettingHelp.html)
