Skip to content

Commit

Permalink
Added timing to the skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikPoppleton committed Aug 29, 2024
1 parent 6052b17 commit ca876ea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion analysis/src/oxDNA_analysis_tools/UTILS/RyeReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def get_top_info_from_traj(traj : str) -> TopInfo:
traj (str) : path to the trajectory file
Returns:
(TopInfo, TrajInfo) : topology and trajectory info
TopInfo : topology info
"""
with open(traj) as f:
l = ''
Expand Down
8 changes: 6 additions & 2 deletions analysis/src/oxDNA_analysis_tools/skeleton.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# This script is a skeleton for parallelized trajectory analysis
import time
start_time = time.time()
import argparse
import numpy as np
from os import path
Expand All @@ -18,7 +20,7 @@ def compute(ctx:ComputeContext, chunk_size:int, chunk_id:int):
return(np.arange(chunk_size)*pirate_stuff)

# All oat scripts have a function with the same name as the script for import into other scripts
def skeleton(top_info:TopInfo, traj_info:TrajInfo, optional_argument:int=0, ncpus:int=1):
def skeleton(top_info:TopInfo, traj_info:TrajInfo, optional_argument:int=0, ncpus:int=1) -> np.ndarray:
"""
This is the docstring that gets picked up by the api documentation builder. You need to add this script to oxDNA/docs/source/oat/{api.md,cli.md}
Expand All @@ -29,7 +31,7 @@ def skeleton(top_info:TopInfo, traj_info:TrajInfo, optional_argument:int=0, ncpu
ncpus (int) : (optional) How many cpus to parallelize the operation. default=1
Returns:
output (np.ndarray): In this case just counting up to chunk_size
np.ndarray: In this case just counting up to 2*chunk_size by 2s
"""
# The ctx is the arguments for the parallelized function
ctx = ComputeContext(top_info, traj_info, optional_argument)
Expand Down Expand Up @@ -96,5 +98,7 @@ def main():
f.write(', '.join([str(o) for o in out]))
log(f"Wrote output to file {outfile}")

print("--- %s seconds ---" % (time.time() - start_time))

if __name__ == '__main__':
main()

0 comments on commit ca876ea

Please sign in to comment.