Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
MathildeVerlyck committed Aug 13, 2024
2 parents e7a4ff4 + ea040d3 commit 158b819
Show file tree
Hide file tree
Showing 22 changed files with 1,511 additions and 42 deletions.
13 changes: 13 additions & 0 deletions tutorials/tutorial_1_annotate_tools-workflow/example_create_sds.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import sparc_flow

new_tool = sparc_flow.Tool()

# name of your tool
new_tool.set_tool_name("tool_extract_indep_var_sds_test")

# directory of where your tool was saved
new_tool.set_tool_dir(".")

# creates sds dataset in the first file path argument, whilst duplicating the contents of the
# second file path argument in dataset > primary > tools
new_tool.create_sds("../resources/tutorial_1_resources/mock_dataset", ".")
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
xFile:
class: File
path: './outputs/time.txt'
path: './resources/time.txt'
outputFile: 'voltage.txt'
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
cwlVersion: v1.2
class: CommandLineTool
baseCommand: [python, ../tool_extract_dep_var_sds.py]
inputs:
x_file:
type: File
inputBinding:
position: 1
<<<<<<< HEAD:tutorials/tutorial_1_annotate_tools-workflow/tool_extract_dep_var_sds.cwl
prefix: --xFile
outputFile:
type: string
inputBinding:
position: 2
prefix: --outputFile
=======
prefix: --x_file

>>>>>>> 628e10f00e2ef94ec25584c0dd9f96d542a1b0fd:tutorials/tutorial_5_assemble_workflow/resources/tools/tool_extract_dep_var_sds.cwl
outputs:
y_file:
type: File

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""
Created on 11/08/2024 (NZT time)
This tool uses obtain dependent variable measurements from a SDS dataset at the
corresponding independent variable measurements from tool_extract_indep_var_sds.py
This tool extracts the dependent variable measurements from a SDS dataset at the
corresponding independent variable measurements from tool_extract_indep_var_sds.py.
Author: Max Dang Vu
Organisation: Auckland Bioengineering Institute
Expand All @@ -18,11 +18,12 @@ def extract_dependent_variable_sds(xFile, outputFile):
"""
This function extracts an array of the dependent variable measurements from a SDS dataset
at the specified independent variable measurements from tool_extract_indep_var_sds.py.
The dependent variable measurements are also saved to a .txt file.
:param xFile: independent variable quantity measurements from dataset extracted from a .txt file
:type xFile: directory
:param outputFile: file path for saving dependent variable measurements from dataset
:type yFile: string
:param outputFile: Output filename for .txt file
:type outputFile: str
"""

# Load file
Expand Down Expand Up @@ -184,6 +185,7 @@ def extract_dependent_variable_sds(xFile, outputFile):
-7.328525557563466932e-07,
-8.203079358028723468e-07]]

# Save dependent variable measurement to .txt files
parent_dir = os.path.dirname(outputFile)
os.makedirs(parent_dir, exist_ok=True)
np.savetxt(outputFile, np.array(y).T, delimiter=',')
Expand Down

Large diffs are not rendered by default.

This file was deleted.

0 comments on commit 158b819

Please sign in to comment.