Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
imaging_compress_pipeline
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LDV
imaging_compress_pipeline
Commits
bf043449
Commit
bf043449
authored
9 months ago
by
Timo Millenaar
Browse files
Options
Downloads
Plain Diff
Merge branch 'scatter_and_aggregate' into 'master'
Make dir references absolute See merge request
!16
parents
02ecc134
c9504e82
No related branches found
No related tags found
1 merge request
!16
Make dir references absolute
Pipeline
#94341
passed
9 months ago
Stage: build
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
aggregate_and_plot.cwl
+7
-3
7 additions, 3 deletions
aggregate_and_plot.cwl
aggregate_and_plot.py
+19
-8
19 additions, 8 deletions
aggregate_and_plot.py
aggregate_and_plot.sh
+9
-5
9 additions, 5 deletions
aggregate_and_plot.sh
with
35 additions
and
16 deletions
aggregate_and_plot.cwl
+
7
−
3
View file @
bf043449
...
@@ -3,12 +3,16 @@ class: CommandLineTool
...
@@ -3,12 +3,16 @@ class: CommandLineTool
requirements:
requirements:
- class: DockerRequirement
- class: DockerRequirement
dockerPull: git.astron.nl:5000/ldv/imaging_compress_pipeline:v0.
4
.1
dockerPull: git.astron.nl:5000/ldv/imaging_compress_pipeline:v0.
5
.1
baseCommand: python3
baseCommand: python3
arguments:
arguments:
-
/src
/aggregate_and_plot.py
-
$(inputs.workdir)/imaging_compress_pipeline.git
/aggregate_and_plot.py
inputs: {}
inputs:
workdir:
type: string
inputBinding:
position: 1 # The first argument after the script will be the workdir
outputs: []
outputs: []
This diff is collapsed.
Click to expand it.
aggregate_and_plot.py
+
19
−
8
View file @
bf043449
#!/usr/bin/env python3
#!/usr/bin/env python3
import
argparse
from
lofar_quality.manipulate.common
import
join_inspect_ds
from
lofar_quality.manipulate.common
import
join_inspect_ds
from
lofar_quality.inspect.inspect_dataset
import
plot_inspect_ds
from
lofar_quality.inspect.inspect_dataset
import
plot_inspect_ds
from
pathlib
import
Path
from
pathlib
import
Path
...
@@ -7,28 +8,38 @@ import logging
...
@@ -7,28 +8,38 @@ import logging
FORMAT
=
'
%(levelname)-15s %(asctime)s: %(message)s
'
FORMAT
=
'
%(levelname)-15s %(asctime)s: %(message)s
'
logging
.
basicConfig
(
format
=
FORMAT
,
level
=
"
INFO
"
)
logging
.
basicConfig
(
format
=
FORMAT
,
level
=
"
INFO
"
)
if
__name__
==
"
__main__
"
:
def
main
():
# Set up argument parser
parser
=
argparse
.
ArgumentParser
(
description
=
"
Process H5 files and output results to a specified directory.
"
)
parser
.
add_argument
(
'
workdir
'
,
type
=
str
,
help
=
'
Path to the working directory
'
)
# Parse the arguments
args
=
parser
.
parse_args
()
workdir
=
Path
(
args
.
workdir
)
# The first command-line argument
h5_paths
=
[]
h5_paths
=
[]
with
open
(
"
/mnt/
workdir
/
inputs.txt
"
,
"
r
"
)
as
file
:
with
open
(
workdir
/
"
inputs.txt
"
,
"
r
"
)
as
file
:
for
line
in
file
:
for
line
in
file
:
line
=
str
(
line
.
strip
())
#
r
emove white space
line
=
str
(
line
.
strip
())
#
R
emove white space
path
=
Path
(
line
)
path
=
Path
(
line
)
if
path
.
exists
():
if
path
.
exists
():
if
path
.
suffix
.
lower
()
==
"
.h5
"
:
if
path
.
suffix
.
lower
()
==
"
.h5
"
:
h5_paths
.
append
(
line
)
h5_paths
.
append
(
line
)
else
:
else
:
logging
.
info
(
f
"
File exists but is not an h5 file:
{
line
}
"
)
logging
.
info
(
f
"
File exists but is not an h5 file:
{
line
}
"
)
else
:
else
:
logging
.
info
(
f
"
Could not find the following input file:
{
line
}
"
)
logging
.
info
(
f
"
Could not find the following input file:
{
line
}
"
)
logging
.
info
(
f
"
Found
{
len
(
h5_paths
)
}
h5 files
"
)
logging
.
info
(
f
"
Found
{
len
(
h5_paths
)
}
h5 files
"
)
h5_output_path
=
"
/mnt/
workdir
/
inspect.h5
"
h5_output_path
=
workdir
/
"
inspect.h5
"
join_inspect_ds
(
h5_paths
,
h5_output_path
)
join_inspect_ds
(
h5_paths
,
h5_output_path
)
plot_paths
=
plot_inspect_ds
(
h5_output_path
,
"
/mnt/
workdir
"
,
min_elevation
=
15
)
plot_paths
=
plot_inspect_ds
(
h5_output_path
,
workdir
,
min_elevation
=
15
)
with
open
(
"
/mnt/
workdir
/
outputs.txt
"
,
"
w
"
)
as
file
:
with
open
(
workdir
/
"
outputs.txt
"
,
"
w
"
)
as
file
:
file
.
write
(
str
(
Path
(
h5_output_path
)
.
absolute
())
+
"
\n
"
)
file
.
write
(
str
(
h5_output_path
.
absolute
())
+
"
\n
"
)
for
file_path
in
plot_paths
:
for
file_path
in
plot_paths
:
path
=
Path
(
file_path
).
absolute
()
path
=
Path
(
file_path
).
absolute
()
file
.
write
(
str
(
path
)
+
"
\n
"
)
file
.
write
(
str
(
path
)
+
"
\n
"
)
if
__name__
==
"
__main__
"
:
main
()
This diff is collapsed.
Click to expand it.
aggregate_and_plot.sh
+
9
−
5
View file @
bf043449
#!/usr/bin/sh
#!/usr/bin/sh
SCRIPT_DIR
=
$(
cd
--
"
$(
dirname
--
"
${
BASH_SOURCE
[0]
}
"
)
"
&> /dev/null
&&
pwd
)
cd
$SCRIPT_DIR
TOIL_VENV_DIR
=
"
${
SCRIPT_DIR
}
/toil_venv"
if
[
-d
"toil_venv"
]
;
then
if
[
-d
"toil_venv"
]
;
then
echo
"Activating existing virtual environment."
echo
"Activating existing virtual environment."
source
toil_venv
/bin/activate
source
"
${
TOIL_VENV_DIR
}
/bin/activate
"
else
else
echo
"Creating new virtual environment for using toil"
echo
"Creating new virtual environment for using toil"
python3.9
-m
venv
toil_venv
python3.9
-m
venv
$TOIL_VENV_DIR
source
toil_venv
/bin/activate
source
"
${
TOIL_VENV_DIR
}
/bin/activate
"
pip
install
--upgrade
pip setuptools wheel
pip
install
--upgrade
pip setuptools wheel
pip
install
toil[cwl] singularity
pip
install
toil[cwl] singularity
fi
fi
export
SINGULARITY_BIND
=
"
$PWD
:/mnt/workdir,/project:/project"
export
SINGULARITY_BIND
=
"/project:/project"
toil-cwl-runner
--singularity
imaging_compress_pipeline.git/aggregate_and_plot.cwl
export
TOIL_SLURM_ARGS
=
"--exclusive"
toil-cwl-runner
"
${
SCRIPT_DIR
}
/imaging_compress_pipeline.git/aggregate_and_plot.cwl"
--workdir
$SCRIPT_DIR
--logDebug
--singularity
--batchSystem
slurm
--batchLogsDir
./logs
--jobStore
./job_store
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment