Skip to content
GitLab
Explore
Sign in
Alice Donini
lst-analysis
Compare revisions
fdbcc686c1b3af0c2b16a2d173fd136c864f180a to 3c1676aa104163baad48d15a69c2aeddd7150979
Commits on Source (2)
Update README
· 5e4e24a5
Alice Donini
authored
Mar 03, 2022
5e4e24a5
Add script for analysis tree creation
· 3c1676aa
Alice Donini
authored
Mar 03, 2022
3c1676aa
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
3c1676aa
...
...
@@ -3,5 +3,47 @@
Collection of scripts to run analysis of LST data at the IT cluster in La Palma.
The repository contains also a folder with some bash scripts that can be easily used.
## Analysis tree
Use
`create_analysis_tree.py`
to create automatically a directory tree.
The default one is:
```
bash
Parent_Folder
└──DL1
├──
source
│ └── night
│ └── version
│ └── cleaning
DL2
├──
source
│ └── night
│ └── version
│ └── cleaning
DL3
└──
source
└── night
└── version
└── cleaning
```
Modify the script at your convenience if you prefer a different structure.
Change the default value for the Parent folder in the argparse with your own path.
Example:
```
bash
python create_analysis_tree.py
--source
Crab
--night
20220304
```
Output:
```
bash
Directory /fefs/aswg/workspace/alice.donini/Analysis/data/DL1/Crab/20220304/v0.9.2/tailcut84 already exists
Directory /fefs/aswg/workspace/alice.donini/Analysis/data/DL2/Crab/20220304/v0.9.2/tailcut84 Created
Directory /fefs/aswg/workspace/alice.donini/Analysis/data/DL3/Crab/20220304/v0.9.2/tailcut84 Created
Directory structure ready
for
analysis on Crab.
```
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
\ No newline at end of file
create_analysis_tree.py
0 → 100644
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
()