Skip to content

Commit

Permalink
add __name__ == __main__ to all scripts (improves sphinx behavior)
Browse files Browse the repository at this point in the history
  • Loading branch information
comcon1 committed Sep 11, 2024
1 parent b5f992b commit ddca537
Show file tree
Hide file tree
Showing 13 changed files with 946 additions and 933 deletions.
33 changes: 17 additions & 16 deletions Scripts/AnalyzeDatabank/NMRPCA_timerelax.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,20 @@
from DatabankLib.analyze import computeNMRPCA


systems = initialize_databank()
resDict = {DatabankLib.RCODE_COMPUTED: 0,
DatabankLib.RCODE_SKIPPED: 0,
DatabankLib.RCODE_ERROR: 0}

for system in systems:
logger.info("System title: " + system['SYSTEM'])
logger.info("System path: " + system['path'])
res = computeNMRPCA(system)
resDict[res] += 1

print(f"""
COMPUTED: {resDict[DatabankLib.RCODE_COMPUTED]}
SKIPPED: {resDict[DatabankLib.RCODE_SKIPPED]}
ERROR: {resDict[DatabankLib.RCODE_ERROR]}
""")
if __name__ == "__main__":
systems = initialize_databank()
resDict = {DatabankLib.RCODE_COMPUTED: 0,
DatabankLib.RCODE_SKIPPED: 0,
DatabankLib.RCODE_ERROR: 0}

for system in systems:
logger.info("System title: " + system['SYSTEM'])
logger.info("System path: " + system['path'])
res = computeNMRPCA(system)
resDict[res] += 1

print(f"""
COMPUTED: {resDict[DatabankLib.RCODE_COMPUTED]}
SKIPPED: {resDict[DatabankLib.RCODE_SKIPPED]}
ERROR: {resDict[DatabankLib.RCODE_ERROR]}
""")
29 changes: 15 additions & 14 deletions Scripts/AnalyzeDatabank/calcAPL.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,20 @@
from DatabankLib.analyze import computeAPL


systems = initialize_databank()
resDict = {DatabankLib.RCODE_COMPUTED: 0,
DatabankLib.RCODE_SKIPPED: 0,
DatabankLib.RCODE_ERROR: 0}
if __name__ == "__main__":
systems = initialize_databank()
resDict = {DatabankLib.RCODE_COMPUTED: 0,
DatabankLib.RCODE_SKIPPED: 0,
DatabankLib.RCODE_ERROR: 0}

for system in systems:
logger.info("System title: " + system['SYSTEM'])
logger.info("System path: " + system['path'])
res = computeAPL(system)
resDict[res] += 1
for system in systems:
logger.info("System title: " + system['SYSTEM'])
logger.info("System path: " + system['path'])
res = computeAPL(system)
resDict[res] += 1

print(f"""
COMPUTED: {resDict[DatabankLib.RCODE_COMPUTED]}
SKIPPED: {resDict[DatabankLib.RCODE_SKIPPED]}
ERROR: {resDict[DatabankLib.RCODE_ERROR]}
""")
print(f"""
COMPUTED: {resDict[DatabankLib.RCODE_COMPUTED]}
SKIPPED: {resDict[DatabankLib.RCODE_SKIPPED]}
ERROR: {resDict[DatabankLib.RCODE_ERROR]}
""")
29 changes: 15 additions & 14 deletions Scripts/AnalyzeDatabank/calcOrderParameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,20 @@
from DatabankLib.analyze import computeOP


systems = initialize_databank()
resDict = {DatabankLib.RCODE_COMPUTED: 0,
DatabankLib.RCODE_SKIPPED: 0,
DatabankLib.RCODE_ERROR: 0}
if __name__ == "__main__":
systems = initialize_databank()
resDict = {DatabankLib.RCODE_COMPUTED: 0,
DatabankLib.RCODE_SKIPPED: 0,
DatabankLib.RCODE_ERROR: 0}

for system in systems:
logger.info("System title: " + system['SYSTEM'])
logger.info("System path: " + system['path'])
res = computeOP(system)
resDict[res] += 1
for system in systems:
logger.info("System title: " + system['SYSTEM'])
logger.info("System path: " + system['path'])
res = computeOP(system)
resDict[res] += 1

print(f"""
COMPUTED: {resDict[DatabankLib.RCODE_COMPUTED]}
SKIPPED: {resDict[DatabankLib.RCODE_SKIPPED]}
ERROR: {resDict[DatabankLib.RCODE_ERROR]}
""")
print(f"""
COMPUTED: {resDict[DatabankLib.RCODE_COMPUTED]}
SKIPPED: {resDict[DatabankLib.RCODE_SKIPPED]}
ERROR: {resDict[DatabankLib.RCODE_ERROR]}
""")
30 changes: 15 additions & 15 deletions Scripts/AnalyzeDatabank/calc_FormFactors.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@
from DatabankLib.core import initialize_databank
from DatabankLib.analyze import computeFF

if __name__ == "__main__":
systems = initialize_databank()
resDict = {DatabankLib.RCODE_COMPUTED: 0,
DatabankLib.RCODE_SKIPPED: 0,
DatabankLib.RCODE_ERROR: 0}

systems = initialize_databank()
resDict = {DatabankLib.RCODE_COMPUTED: 0,
DatabankLib.RCODE_SKIPPED: 0,
DatabankLib.RCODE_ERROR: 0}
for system in systems:
logger.info("System title: " + system['SYSTEM'])
logger.info("System path: " + system['path'])
res = computeFF(system)
resDict[res] += 1

for system in systems:
logger.info("System title: " + system['SYSTEM'])
logger.info("System path: " + system['path'])
res = computeFF(system)
resDict[res] += 1

print(f"""
COMPUTED: {resDict[DatabankLib.RCODE_COMPUTED]}
SKIPPED: {resDict[DatabankLib.RCODE_SKIPPED]}
ERROR: {resDict[DatabankLib.RCODE_ERROR]}
""")
print(f"""
COMPUTED: {resDict[DatabankLib.RCODE_COMPUTED]}
SKIPPED: {resDict[DatabankLib.RCODE_SKIPPED]}
ERROR: {resDict[DatabankLib.RCODE_ERROR]}
""")
29 changes: 15 additions & 14 deletions Scripts/AnalyzeDatabank/calc_thickness.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,20 @@
from DatabankLib.analyze import computeTH


systems = initialize_databank()
resDict = {DatabankLib.RCODE_COMPUTED: 0,
DatabankLib.RCODE_SKIPPED: 0,
DatabankLib.RCODE_ERROR: 0}
if __name__ == "__main__":
systems = initialize_databank()
resDict = {DatabankLib.RCODE_COMPUTED: 0,
DatabankLib.RCODE_SKIPPED: 0,
DatabankLib.RCODE_ERROR: 0}

for system in systems:
logger.info("System title: " + system['SYSTEM'])
logger.info("System path: " + system['path'])
res = computeTH(system)
resDict[res] += 1
for system in systems:
logger.info("System title: " + system['SYSTEM'])
logger.info("System path: " + system['path'])
res = computeTH(system)
resDict[res] += 1

print(f"""
COMPUTED: {resDict[DatabankLib.RCODE_COMPUTED]}
SKIPPED: {resDict[DatabankLib.RCODE_SKIPPED]}
ERROR: {resDict[DatabankLib.RCODE_ERROR]}
""")
print(f"""
COMPUTED: {resDict[DatabankLib.RCODE_COMPUTED]}
SKIPPED: {resDict[DatabankLib.RCODE_SKIPPED]}
ERROR: {resDict[DatabankLib.RCODE_ERROR]}
""")
10 changes: 6 additions & 4 deletions Scripts/AnalyzeDatabank/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from DatabankLib.databankLibrary import initialize_databank, lipids_dict

systems = initialize_databank()

for system in systems:
print(system)

if __name__ == "__main__":
systems = initialize_databank()

for system in systems:
print(system)


Loading

0 comments on commit ddca537

Please sign in to comment.