Folder Walker

9.1. Folder Walker#

import sys
sys.path.insert(0, '../../../molass-library')
sys.path.insert(0, '../../../molass-legacy')
import os
import matplotlib.pyplot as plt
from molass.Local import get_local_settings
from molass.DataUtils.FolderWalker import walk_folders
from molass.Global.Options import set_molass_options
set_molass_options(flowchange='auto')
local_settings = get_local_settings()
DATA_ROOT_FOLDER = local_settings['DATA_ROOT_FOLDER']
from molass.DataObjects import SecSaxsData as SSD

output_folder = "figs"
if not os.path.exists(output_folder):
    os.makedirs(output_folder)

for k, path in enumerate(walk_folders(DATA_ROOT_FOLDER)):
    if k < 0:
        continue
    print([k], path)
    ssd = SSD(path, remove_bubbles=True)
    if ssd.uv is None:
        print("No UV data found in %s, skipping." % path)
        continue
    title = "Compact Plot for %s" % path
    result = ssd.plot_compact(title=title)
    result.savefig(os.path.join(output_folder, "plot_%03d.png" % k))
    result.close()
    if k > 3:
        break
[0] C:\Users\takahashi\PyTools\Data\00_model_001
get_limit_impl failed.  File "C:\Users\takahashi\GitHub\molass-technical\chapters\70\../../../molass-legacy\molass_legacy\Trimming\FlangeLimit.py", line 37, in get_limit
    self.get_limit_impl(self.e_curve, self.data, self.error, self.logger, debug=debug)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\takahashi\GitHub\molass-technical\chapters\70\../../../molass-legacy\molass_legacy\Trimming\FlangeLimit.py", line 140, in get_limit_impl
    if not is_limit or fmin < safe_f:
           ^^^^^^^^
UnboundLocalError: cannot access local variable 'is_limit' where it is not associated with a value
[1] C:\Users\takahashi\PyTools\Data\00_model_005
get_limit_impl failed.  File "C:\Users\takahashi\GitHub\molass-technical\chapters\70\../../../molass-legacy\molass_legacy\Trimming\FlangeLimit.py", line 37, in get_limit
    self.get_limit_impl(self.e_curve, self.data, self.error, self.logger, debug=debug)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\takahashi\GitHub\molass-technical\chapters\70\../../../molass-legacy\molass_legacy\Trimming\FlangeLimit.py", line 140, in get_limit_impl
    if not is_limit or fmin < safe_f:
           ^^^^^^^^
UnboundLocalError: cannot access local variable 'is_limit' where it is not associated with a value
[2] C:\Users\takahashi\PyTools\Data\20160227\backsub
zeros at the angular ends of error data have been replaced with the adjacent values.
[3] C:\Users\takahashi\PyTools\Data\20160628
C:\Users\takahashi\GitHub\molass-technical\chapters\70\../../../molass-library\molass\Mapping\PeakMatcher.py:22: SmallSampleWarning: One or more sample arguments is too small; all returned values will be NaN. See documentation for sample size requirements.
  slope, intercept, r_value, p_value, std_err = linregress(x, y)
[4] C:\Users\takahashi\PyTools\Data\20161006\OA01\Backsub
zeros at the angular ends of error data have been replaced with the adjacent values.