Functions
bp_utils Namespace Reference

Functions

def progressBar (value, endvalue, docdb_id, bar_length=40)
 
def ListBlessedFilesInDir (dir)
 
def ListCaptionFilesInDir (dir)
 
def ListPlotsInDirForCaption (dir, cap)
 

Function Documentation

def bp_utils.ListBlessedFilesInDir (   dir)

Definition at line 15 of file bp_utils.py.

References novadaq::HexUtils.format().

16  ret = []
17  for root, dirs, files in os.walk(dir):
18  # ignore weird system directories
19  if root.find('__MACOSX') > 0: continue
20 
21  # loop over files in dir and all subdirectories
22  for file in files:
23  # ignore dotfilfes
24  if file.startswith('.'): continue
25 
26  # ignore files that don't have an expected .txt extension
27  if os.path.splitext(os.path.basename(file))[1][1:] not in config.CAPTION_EXTS: continue
28  ret.append('{}/{}'.format(root, file)[2:])
29 
30  # find all files with images extensions that are associated with this caption file
31  for file2 in files:
32  if os.path.splitext(os.path.basename(file2))[0] != os.path.splitext(os.path.basename(file))[0] or os.path.splitext(os.path.basename(file2))[1][1:] not in config.PLOT_EXTS: continue
33 
34  ret.append('{}/{}'.format(root, file2)[2:])
35 
36  return ret
37 
38 
std::string format(const int32_t &value, const int &ndigits=8)
Definition: HexUtils.cpp:14
def ListBlessedFilesInDir(dir)
Definition: bp_utils.py:15
def bp_utils.ListCaptionFilesInDir (   dir)

Definition at line 39 of file bp_utils.py.

References novadaq::HexUtils.format().

40  ret = []
41  for root, dirs, files in os.walk(dir):
42  # ignore weird system directories
43  if root.find('__MACOSX') > 0: continue
44 
45  # loop over files in dir and all subdirectories
46  for file in files:
47  # ignore dotfilfes
48  if file.startswith('.'): continue
49 
50  # ignore files that don't have an expected .txt extension
51  if os.path.splitext(os.path.basename(file))[1][1:] not in config.CAPTION_EXTS: continue
52  ret.append('{}/{}'.format(root, file)[2:])
53 
54  return ret
55 
56 
def ListCaptionFilesInDir(dir)
Definition: bp_utils.py:39
std::string format(const int32_t &value, const int &ndigits=8)
Definition: HexUtils.cpp:14
def bp_utils.ListPlotsInDirForCaption (   dir,
  cap 
)

Definition at line 57 of file bp_utils.py.

References novadaq::HexUtils.format().

58  ret = []
59  for root, dirs, files in os.walk(dir):
60  # ignore weird system directories
61  if root.find('__MACOSX') > 0: continue
62 
63  # loop over files in dir and all subdirectories
64  for file in files:
65  # ignore dotfilfes
66  if file.startswith('.'): continue
67 
68  if os.path.splitext(os.path.basename(file))[0] != os.path.splitext(os.path.basename(cap))[0] or os.path.splitext(os.path.basename(file))[1][1:] not in config.PLOT_EXTS: continue
69 
70  ret.append('{}/{}'.format(root, file)[2:])
71 
72  return ret
73 
def ListPlotsInDirForCaption(dir, cap)
Definition: bp_utils.py:57
std::string format(const int32_t &value, const int &ndigits=8)
Definition: HexUtils.cpp:14
def bp_utils.progressBar (   value,
  endvalue,
  docdb_id,
  bar_length = 40 
)

Definition at line 6 of file bp_utils.py.

References check_time_usage.float, novadaq::HexUtils.format(), makeTrainCVSamples.int, and stan::math.round().

Referenced by dbutils::gui::DCSConfigEditorDisplay.generateRecipeScripts(), dbutils::gui::CustomTabWidget.loadData(), dbutils::gui::TabbedSetOfTableEditors.loadData(), dbutils::gui::TabbedSetOfTreeEditors.loadData(), dbutils::gui::CustomTabWidget.saveChanges(), dbutils::gui::TabbedSetOfTableEditors.saveChanges(), and dbutils::gui::TabbedSetOfTreeEditors.saveChanges().

6 def progressBar(value, endvalue, docdb_id, bar_length=40):
7  percent = float(value) / endvalue
8  arrow = '=' * int(round(percent * bar_length)-1) + '>'
9  spaces = ' ' * (bar_length - len(arrow))
10 
11  sys.stdout.write("\rProgress: [\033[01;32m{0}\033[00m] {1}/{2} ({3}%) -- DocDB {4}".format(arrow + spaces, value, endvalue, int(round(percent * 100)), docdb_id))
12  sys.stdout.flush()
13 
14 
def progressBar(value, endvalue, docdb_id, bar_length=40)
Definition: bp_utils.py:6
fvar< T > round(const fvar< T > &x)
Definition: round.hpp:23
std::string format(const int32_t &value, const int &ndigits=8)
Definition: HexUtils.cpp:14