Commit 6913ec0a authored by Salko Jr, Robert's avatar Salko Jr, Robert
Browse files

Make dnb summary generator installable

Change some names to make the package more general purpose.
parent 60dbb229
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -2,8 +2,8 @@ import h5py
import numpy as np


class CtfHDF5(object):
   """ An interface to the CTF HDF5 file
class Hdf5Interface(object):
   """ An interface to the SubKit formatted HDF5 file

   Args:
      fname (str): Path to the HDF5 file to be read
@@ -278,7 +278,7 @@ class CtfHDF5(object):
         pin (int) : The pin index to extract data
         level (int) : The axial level to extract data (zero-based)
         azimuthal (int) : Azimuthal index.  Currently not supported.  Azimuthal data is averaged.
         includeCenterline (bool): CTF does not model the centerline, but estimates it.  Select True to include
         includeCenterline (bool): Select True to include
            this estimate in the returned data.

      Returns:
+5 −5
Original line number Diff line number Diff line
from CtfHDF5 import CtfHDF5
from Hdf5Tools import Hdf5Interface
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt

class CtfPlotTools(object):
   """ A class for making plots of CTF data
class PlotTools(object):
   """ A class for making plots of SubKit HDF5 file data

   Args:
      fname (str): Path to the CTF HDF5 file
      fname (str): Path to the HDF5 file
   """
   def __init__(me, fname):
      me.h5obj = CtfHDF5(fname)
      me.h5obj = Hdf5Interface(fname)

   def _getPlotLocation(me, state, pin, level):
      """ Used to get the location of data to plot while checking for errors in input
+2 −2
Original line number Diff line number Diff line
from CtfHDF5 import CtfHDF5
from Hdf5Tools import Hdf5Interface
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../')))
@@ -12,7 +12,7 @@ class SummaryTools(object):

    """
    def __init__(me, h5file):
        me.h5 = CtfHDF5(h5file)
        me.h5 = Hdf5Interface(h5file)

    def genDNBSummary(me, fname=None, units=None):
        """ Prints summary information for limiting rod/channel"""
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ from SummaryTools import SummaryTools

def main():
   parser = argparse.ArgumentParser(description="Generates a summary of solution data relevent to DNB analysis")
   parser.add_argument('h5name', type=str, help="CTF HDF5 file")
   parser.add_argument('h5name', type=str, help="HDF5 file")
   parser.add_argument('--units', choices=["si", "british"], type=str, help="Selector for physical units (default si)")
   parser.add_argument('--fname', type=str, help="Output summary file name")
   args = parser.parse_args()
+3 −3
Original line number Diff line number Diff line
import argparse
from CtfPlotTools import CtfPlotTools
from PlotTools import PlotTools

def main():
   parser = argparse.ArgumentParser(description="Plot the axial void distribution in a channel.  All indices are 1-based.")
   parser.add_argument('h5name', type=str, help="CTF HDF5 file")
   parser.add_argument('h5name', type=str, help="HDF5 file")
   parser.add_argument('--state', type=int, nargs="?", help="State to plot.  Defaults to state with max void.")
   parser.add_argument('--ch', type=int, nargs="?", help="Channel to plot.  Defaults to channel with max void.")
   parser.add_argument('--figname', type=str, nargs="?", help="Name of figure.  Defaults to name based on location of DNBR.")
   args = parser.parse_args()

   plotter = CtfPlotTools(args.h5name)
   plotter = PlotTools(args.h5name)

   plotter.plotChAxialVoid(args.state, args.ch, args.figname)

Loading