Beispiel #1
0
def sid_from_compute_file(path):
    """Get sid from path to report file

    Args:
        path (py.path): must be an existing report file

    Returns:
        str: simulation id
    """
    assert path.check(file=1)
    return _sim_from_path(path)[0]
Beispiel #2
0
 def _sdds(filename):
     path = run_dir.join(filename)
     assert path.check(file=True, exists=True), \
         '{}: not found'.format(path)
     if not options.suffix:
         with open(str(path)) as f:
             return path.basename, f.read(), 'application/octet-stream'
     if options.suffix == 'csv':
         out = elegant_common.subprocess_output(['sddsprintout', '-columns', '-spreadsheet=csv', str(path)])
         assert out, \
             '{}: invalid or empty output from sddsprintout'.format(path)
         return path.purebasename + '.csv', out, 'text/csv'
     raise AssertionError('{}: invalid suffix for download path={}'.format(options.suffix, path))
Beispiel #3
0
 def _sdds(filename):
     path = run_dir.join(filename)
     assert path.check(file=True, exists=True), \
         '{}: not found'.format(path)
     if not options.suffix:
         with open(str(path)) as f:
             return path.basename, f.read(), 'application/octet-stream'
     if options.suffix == 'csv':
         out = elegant_common.subprocess_output(
             ['sddsprintout', '-columns', '-spreadsheet=csv',
              str(path)])
         assert out, \
             '{}: invalid or empty output from sddsprintout'.format(path)
         return path.purebasename + '.csv', out, 'text/csv'
     raise AssertionError('{}: invalid suffix for download path={}'.format(
         options.suffix, path))
Beispiel #4
0
 def _sdds(filename):
     path = run_dir.join(filename)
     assert path.check(file=True, exists=True), \
         '{}: not found'.format(path)
     if not options.suffix:
         return path
     if options.suffix == 'csv':
         out = elegant_common.subprocess_output(
             ['sddsprintout', '-columns', '-spreadsheet=csv',
              str(path)])
         assert out, \
             '{}: invalid or empty output from sddsprintout'.format(path)
         return PKDict(
             uri=path.purebasename + '.csv',
             content=out,
         )
     raise AssertionError('{}: invalid suffix for download path={}'.format(
         options.suffix, path))