Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-advanced-user-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
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
Code review analytics
Issue 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
caosdb
Software
caosdb-advanced-user-tools
Commits
73f72995
Commit
73f72995
authored
6 years ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
license and helper for creating fake data tree
parent
d524ba4a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/caosadvancedtools/cfood.py
+23
-2
23 additions, 2 deletions
src/caosadvancedtools/cfood.py
unittests/create_filetree.py
+83
-0
83 additions, 0 deletions
unittests/create_filetree.py
unittests/test_cfood.py
+23
-0
23 additions, 0 deletions
unittests/test_cfood.py
with
129 additions
and
2 deletions
src/caosadvancedtools/cfood.py
+
23
−
2
View file @
73f72995
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#!/usr/bin/env python
# encoding: utf-8
#
# ** header v3.0
# This file is a part of the CaosDB Project.
#
# Copyright (C) 2018 Research Group Biomedical Physics,
# Max-Planck-Institute for Dynamics and Self-Organization Göttingen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# ** end header
"""
does something
"""
import
argparse
...
...
This diff is collapsed.
Click to expand it.
unittests/create_filetree.py
0 → 100644
+
83
−
0
View file @
73f72995
#!/usr/bin/env python
# encoding: utf-8
#
# ** header v3.0
# This file is a part of the CaosDB Project.
#
# Copyright (C) 2018 Research Group Biomedical Physics,
# Max-Planck-Institute for Dynamics and Self-Organization Göttingen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# ** end header
"""
creates a folder structure with fake data files
"""
import
argparse
import
numpy
as
np
import
os
from
argparse
import
RawTextHelpFormatter
from
datetime
import
datetime
,
timedelta
def
main
(
folder
,
dry
=
True
):
base_path
=
os
.
path
.
realpath
(
folder
)
print
(
"
Base directory:
\n
"
+
base_path
)
if
not
os
.
path
.
exists
(
base_path
)
and
not
dry
:
os
.
system
(
"
mkdir -p
"
+
base_path
)
for
ii
,
ser
in
enumerate
([
"
Series_{}
"
.
format
(
i
)
for
i
in
range
(
3
)]):
series_path
=
os
.
path
.
join
(
base_path
,
ser
)
print
(
"
Series:
\n
"
+
ser
+
"
\n
"
)
if
not
dry
:
os
.
mkdir
(
series_path
)
for
date
in
[
datetime
.
today
()
-
timedelta
(
days
=
i
)
-
timedelta
(
weeks
=
50
*
ii
)
for
i
in
range
(
10
)]:
#import IPython
#IPython.embed()
exp_path
=
os
.
path
.
join
(
series_path
,
"
Exp_
"
+
str
(
date
.
date
()))
print
(
"
Exp:
"
+
os
.
path
.
basename
(
exp_path
))
if
not
dry
:
os
.
mkdir
(
exp_path
)
for
measurement
in
[
"
Measurement_{}
"
.
format
(
i
)
for
i
in
range
(
3
)]:
m_path
=
os
.
path
.
join
(
exp_path
,
measurement
)
print
(
"
Measurement:
"
+
os
.
path
.
basename
(
m_path
))
if
not
dry
:
os
.
mkdir
(
m_path
)
for
sec
in
[
np
.
random
.
randint
(
7000
)
for
i
in
range
(
20
)]:
d_path
=
os
.
path
.
join
(
m_path
,
"
data_{}.dat
"
.
format
(
(
date
-
timedelta
(
seconds
=
sec
)).
isoformat
()))
if
not
dry
:
os
.
system
(
"
touch
"
+
d_path
)
def
get_parser
():
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
,
formatter_class
=
RawTextHelpFormatter
)
parser
.
add_argument
(
"
folder
"
)
parser
.
add_argument
(
"
-d
"
,
"
--dry-run
"
,
action
=
"
store_true
"
)
return
parser
if
__name__
==
"
__main__
"
:
parser
=
get_parser
()
args
=
parser
.
parse_args
()
main
(
args
.
folder
,
dry
=
args
.
dry_run
)
This diff is collapsed.
Click to expand it.
unittests/test_cfood.py
+
23
−
0
View file @
73f72995
#!/usr/bin/env python
# encoding: utf-8
#
# ** header v3.0
# This file is a part of the CaosDB Project.
#
# Copyright (C) 2018 Research Group Biomedical Physics,
# Max-Planck-Institute for Dynamics and Self-Organization Göttingen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# ** end header
import
unittest
from
tempfile
import
NamedTemporaryFile
...
...
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