Robustness Testing

9.2. Robustness Testing#

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
        pass