Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LRGP - TIRAMISU
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
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
FAGES Timothee
LRGP - TIRAMISU
Commits
f9a29877
Commit
f9a29877
authored
10 months ago
by
FAGES Timothee
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
32e9e7bf
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
TIRAMISU/Main_exe_1.py
+75
-0
75 additions, 0 deletions
TIRAMISU/Main_exe_1.py
with
75 additions
and
0 deletions
TIRAMISU/Main_exe_1.py
0 → 100644
+
75
−
0
View file @
f9a29877
import
time
import
datetime
import
pickle
import
sys
import
os
sys
.
path
.
append
(
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'
..
'
)))
from
TIRAMISU
import
read_model_new
as
rm
from
TIRAMISU
import
make_translation
as
mt
from
TIRAMISU
import
add_and_write_mechanism
as
awm
with
open
(
sys
.
argv
[
1
],
'
r
'
)
as
file_input
:
file
=
file_input
.
readlines
()
# with open("0.txt", 'r') as file_input :
# file = file_input.readlines()
file
=
[
x
for
x
in
file
if
x
.
strip
()[
0
]
!=
'
!
'
]
core_path
=
file
[
0
].
strip
()
translate_path
=
file
[
1
].
strip
()
name_core
=
os
.
path
.
basename
(
core_path
)
name_translate
=
os
.
path
.
basename
(
translate_path
)
output
=
file
[
2
].
strip
()
n
=
10000
n_find
=
False
do_translation
=
True
translation_find
=
False
for
line
in
file
:
if
"
n=
"
in
line
[:
2
].
strip
()
:
n_find
=
True
n
=
int
(
line
.
strip
()[
2
:])
if
"
translation=
"
in
line
.
strip
()[:
12
]
:
translation_find
=
True
tmp_bool
=
(
line
.
strip
()[
12
:]).
casefold
()
if
'
true
'
in
tmp_bool
:
do_translation
=
True
elif
'
false
'
in
tmp_bool
:
do_translation
=
False
else
:
raise
Exception
(
'
Error: translation keyword not True nor False.
'
)
if
n_find
is
False
:
print
(
'
No maximum number of permutation specified (n=). Default is n=10000.
'
)
if
translation_find
is
False
:
print
(
'
No boolean for translation (translation=True or False). Default is translation=True.
'
)
print
(
f
'
\n
translation=
{
do_translation
}
'
)
path_mech_core
=
f
'
{
core_path
}
.mech
'
path_therm_core
=
f
'
{
core_path
}
.therm
'
path_trans_core
=
f
'
{
core_path
}
.trans
'
path_mech_to_translate
=
f
'
{
translate_path
}
.mech
'
path_therm_to_translate
=
f
'
{
translate_path
}
.therm
'
path_trans_to_translate
=
f
'
{
translate_path
}
.trans
'
time_start
=
time
.
time
()
model_to_translate
=
rm
.
Model
(
path_mech_to_translate
,
path_therm_to_translate
,
output
,
path_trans_to_translate
,
verbose
=
False
)
model_core
=
rm
.
Model
(
path_mech_core
,
path_therm_core
,
output
,
path_trans_core
,
verbose
=
False
)
time_end
=
time
.
time
()
print
(
f
'
\n
Total time for model compilation =
{
time_end
-
time_start
}
seconds or
{
datetime
.
timedelta
(
seconds
=
(
time_end
-
time_start
))
}
'
)
print
(
f
'
\n
model_to_translate Species =
{
len
(
model_to_translate
.
reactions
[
1
])
}
Reactions =
{
len
(
model_to_translate
.
reactions
[
2
])
}
'
)
print
(
f
'
\n
model_core Species =
{
len
(
model_core
.
reactions
[
1
])
}
Reactions =
{
len
(
model_core
.
reactions
[
2
])
}
'
)
with
open
(
f
'
{
output
}{
name_translate
}
.pick
'
,
'
wb
'
)
as
m1
:
pickle
.
dump
(
model_to_translate
,
m1
)
with
open
(
f
'
{
output
}{
name_core
}
.pick
'
,
'
wb
'
)
as
m2
:
pickle
.
dump
(
model_core
,
m2
)
if
do_translation
is
True
:
time_start
=
time
.
time
()
stock
=
mt
.
models_translation
(
model_to_translate
,
model_core
,
output
,
350
,
n
)
time_end
=
time
.
time
()
print
(
f
'
\n
Total time =
{
time_end
-
time_start
}
seconds or
{
datetime
.
timedelta
(
seconds
=
(
time_end
-
time_start
))
}
'
)
print
(
'
\n\n
Open and complete translation in
"
tmp_species_traduction.tmp
"
. Then change name to
"
tmp_species_traduction.inp
"
.
\n
END OF PART 1
'
)
\ No newline at end of file
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