Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lst-analysis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alice Donini
lst-analysis
Commits
3c1676aa
Commit
3c1676aa
authored
3 years ago
by
Alice Donini
Browse files
Options
Downloads
Patches
Plain Diff
Add script for analysis tree creation
parent
5e4e24a5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
create_analysis_tree.py
+95
-0
95 additions, 0 deletions
create_analysis_tree.py
with
95 additions
and
0 deletions
create_analysis_tree.py
0 → 100644
+
95
−
0
View file @
3c1676aa
"""
Create the directory structure for an analysis.
Change the default value for the Parent folder in the argparse
Parent_Folder
└──DL1
├── source
│ └── night
│ └── version
│ └── cleaning
DL2
├── source
│ └── night
│ └── version
│ └── cleaning
DL3
└── source
└── night
└── version
└── cleaning
"""
import
os
import
argparse
from
argparse
import
RawTextHelpFormatter
def
makedir
(
name
):
"""
Create folder if non-existent and output OS error if any.
Parameters
----------
name : str
Name of the analysis.
"""
# Create target Directory if don't exist
if
not
os
.
path
.
exists
(
name
):
os
.
makedirs
(
name
)
print
(
"
Directory
"
,
name
,
"
Created
"
)
else
:
print
(
"
Directory
"
,
name
,
"
already exists
"
)
return
None
def
main
():
# define command-line arguments
description
=
'
Create a directory structure
'
parser
=
argparse
.
ArgumentParser
(
description
=
description
,
formatter_class
=
RawTextHelpFormatter
)
parser
.
add_argument
(
'
--main_dir
'
,
type
=
str
,
required
=
False
,
dest
=
'
main_dir
'
,
default
=
'
/fefs/aswg/workspace/alice.donini/Analysis/data
'
,
help
=
'
Path to parent folder
'
)
parser
.
add_argument
(
'
--source
'
,
type
=
str
,
required
=
True
,
dest
=
'
source
'
,
help
=
'
Source name
'
)
parser
.
add_argument
(
'
--night
'
,
type
=
str
,
required
=
True
,
dest
=
'
night
'
,
help
=
'
Night date
'
)
parser
.
add_argument
(
'
--version
'
,
type
=
str
,
required
=
False
,
dest
=
'
version
'
,
default
=
'
v0.9.2
'
,
help
=
'
lstchain version
'
)
parser
.
add_argument
(
'
--cleaning
'
,
type
=
str
,
required
=
False
,
dest
=
'
cleaning
'
,
default
=
'
tailcut84
'
,
help
=
'
Cleaning type
'
)
args
=
parser
.
parse_args
()
# Define analysis directories and subdirectories
data_dir
=
[
'
DL1
'
,
'
DL2
'
,
'
DL3
'
]
structure
=
f
'
{
args
.
source
}
/
{
args
.
night
}
/
{
args
.
version
}
/
{
args
.
cleaning
}
'
for
folder
in
data_dir
:
dirName
=
os
.
path
.
join
(
f
'
{
args
.
main_dir
}
'
,
str
(
folder
),
structure
)
makedir
(
dirName
)
print
(
f
'
Directory structure ready for analysis on
{
args
.
source
}
.
'
)
if
__name__
==
"
__main__
"
:
main
()
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