Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RDStackingProject
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
Model registry
Operate
Environments
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
Xisco Jimenez Forteza
RDStackingProject
Commits
841b6d2e
Commit
841b6d2e
authored
4 years ago
by
Francisco Jimenez Forteza
Browse files
Options
Downloads
Patches
Plain Diff
fixing utilities
parent
820882a6
Branches
master
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
code_new/Sumit/rdown.py
+3
-3
3 additions, 3 deletions
code_new/Sumit/rdown.py
code_new/Sumit/rdown_utilities.py
+18
-5
18 additions, 5 deletions
code_new/Sumit/rdown_utilities.py
code_new/Sumit/read_data.py
+1
-1
1 addition, 1 deletion
code_new/Sumit/read_data.py
with
22 additions
and
9 deletions
code_new/Sumit/rdown.py
+
3
−
3
View file @
841b6d2e
...
@@ -35,16 +35,16 @@ q_fpars=[[0.584077, 1.52053, -0.480658], [0.00561441, 0.630715, -0.432664], [-0.
...
@@ -35,16 +35,16 @@ q_fpars=[[0.584077, 1.52053, -0.480658], [0.00561441, 0.630715, -0.432664], [-0.
c
=
2.99792458
*
10
**
8
;
G
=
6.67259
*
10
**
(
-
11
);
MS
=
1.9885
*
10
**
30
;
c
=
2.99792458
*
10
**
8
;
G
=
6.67259
*
10
**
(
-
11
);
MS
=
1.9885
*
10
**
30
;
class
Ringdown_Spectrum
:
class
Ringdown_Spectrum
:
"""
RDown model generator
"""
"""
RDown model generator
"""
def
__init__
(
self
,
mf
,
af
,
l
,
m
,
n
=
4
,
s
=-
2
,
time
=
[],
fixed
=
False
,
qnm_model
=
'
berti
'
,
rdowndata
=
[]):
def
__init__
(
self
,
mf
,
af
,
l
,
m
,
n
=
4
,
s
=-
2
,
time
=
[],
model
=
'
w-tau
'
,
qnm_model
=
'
berti
'
,
rdowndata
=
[]):
self
.
mf
=
mf
self
.
mf
=
mf
self
.
af
=
af
self
.
af
=
af
self
.
l
=
l
self
.
l
=
l
self
.
m
=
m
self
.
m
=
m
self
.
n
=
n
self
.
n
=
n
self
.
time
=
time
self
.
time
=
time
self
.
model
=
model
self
.
grav_220
=
[
qnm
.
modes_cache
(
s
=
s
,
l
=
self
.
l
,
m
=
self
.
m
,
n
=
i
)
for
i
in
range
(
0
,
self
.
n
+
1
)]
self
.
grav_220
=
[
qnm
.
modes_cache
(
s
=
s
,
l
=
self
.
l
,
m
=
self
.
m
,
n
=
i
)
for
i
in
range
(
0
,
self
.
n
+
1
)]
self
.
dim
=
self
.
n
+
1
self
.
dim
=
self
.
n
+
1
self
.
fixed
=
fixed
self
.
qnm_model
=
qnm_model
self
.
qnm_model
=
qnm_model
self
.
dict_omega
=
{
'
berti
'
:
self
.
QNM_Berti
,
'
qnm
'
:
self
.
QNM_spectrum
}
self
.
dict_omega
=
{
'
berti
'
:
self
.
QNM_Berti
,
'
qnm
'
:
self
.
QNM_spectrum
}
self
.
rdowndata
=
rdowndata
self
.
rdowndata
=
rdowndata
...
@@ -53,7 +53,7 @@ class Ringdown_Spectrum:
...
@@ -53,7 +53,7 @@ class Ringdown_Spectrum:
if
len
(
self
.
time
)
==
0
:
if
len
(
self
.
time
)
==
0
:
self
.
time
=
np
.
arange
(
0
,
100
,
0.1
)
self
.
time
=
np
.
arange
(
0
,
100
,
0.1
)
if
self
.
fixed
:
if
self
.
model
==
'
w-tau-
fixed
'
:
omegas_new
=
np
.
asarray
([
self
.
grav_220
[
i
](
a
=
self
.
af
)[
0
]
for
i
in
range
(
0
,
self
.
dim
)])
omegas_new
=
np
.
asarray
([
self
.
grav_220
[
i
](
a
=
self
.
af
)[
0
]
for
i
in
range
(
0
,
self
.
dim
)])
self
.
w
=
(
np
.
real
(
omegas_new
))
/
self
.
mf
self
.
w
=
(
np
.
real
(
omegas_new
))
/
self
.
mf
self
.
tau
=-
1
/
(
np
.
imag
(
omegas_new
))
*
self
.
mf
self
.
tau
=-
1
/
(
np
.
imag
(
omegas_new
))
*
self
.
mf
...
...
This diff is collapsed.
Click to expand it.
code_new/Sumit/rdown_utilities.py
+
18
−
5
View file @
841b6d2e
...
@@ -29,6 +29,8 @@ from dynesty import utils as dyfunc
...
@@ -29,6 +29,8 @@ from dynesty import utils as dyfunc
import
os
import
os
import
csv
import
csv
import
pandas
as
pd
import
pandas
as
pd
import
pickle
import
rdown
as
rd
def
posterior_samples
(
sampler
):
def
posterior_samples
(
sampler
):
"""
"""
...
@@ -285,10 +287,9 @@ def get_best_amps(pars,parser=None,nr_code=None):
...
@@ -285,10 +287,9 @@ def get_best_amps(pars,parser=None,nr_code=None):
npamps
=
np
.
concatenate
((
amp_mock
,
ph_mock
))
npamps
=
np
.
concatenate
((
amp_mock
,
ph_mock
))
return
npamps
return
npamps
def
convert_m_af_2_w_tau_post
(
res
,
fitnoise
=
False
):
def
convert_m_af_2_w_tau_post
(
res
,
rdown
,
fitnoise
=
False
):
samples_2
=
res
.
samples
samps
=
res
.
samples
samps
=
f2
.
results
.
samples
if
fitnoise
:
if
fitnoise
:
fmass_spin
=
(
samps
.
T
)[
-
3
:
-
1
].
T
fmass_spin
=
(
samps
.
T
)[
-
3
:
-
1
].
T
...
@@ -297,10 +298,22 @@ def convert_m_af_2_w_tau_post(res,fitnoise=False):
...
@@ -297,10 +298,22 @@ def convert_m_af_2_w_tau_post(res,fitnoise=False):
#fmass_spin=new_samples[-2:]
#fmass_spin=new_samples[-2:]
fmass_spin_dist
=
[
None
]
*
len
(
fmass_spin
)
fmass_spin_dist
=
[
None
]
*
len
(
fmass_spin
)
weight
=
np
.
exp
(
res
.
logwt
-
res
.
logz
[
-
1
])
weight
=
np
.
exp
(
res
.
logwt
-
res
.
logz
[
-
1
])
for
i
in
range
(
len
(
fmass_spin
)):
for
i
in
range
(
len
(
fmass_spin
)):
fmass_spin_dist
[
i
]
=
np
.
concatenate
(
dict_omega
[
qnm_model
]
(
fmass_spin
[
i
,
0
],
fmass_spin
[
i
,
1
]
,
2
,
2
))
fmass_spin_dist
[
i
]
=
np
.
concatenate
(
rdown
.
QNM_Berti
(
fmass_spin
[
i
,
0
],
fmass_spin
[
i
,
1
]))
fmass_spin_dist_v2
=
np
.
asarray
(
fmass_spin_dist
)
fmass_spin_dist_v2
=
np
.
asarray
(
fmass_spin_dist
)
new_samples
=
dyfunc
.
resample_equal
(
fmass_spin_dist_v2
,
weight
)
new_samples
=
dyfunc
.
resample_equal
(
fmass_spin_dist_v2
,
weight
)
return
new_samples
return
new_samples
def
save_object
(
obj
,
filename
):
with
open
(
filename
,
'
wb
'
)
as
output
:
# Overwrites any existing file.
pickle
.
dump
(
obj
,
output
,
pickle
.
HIGHEST_PROTOCOL
)
def
rm_files
(
files
):
"""
rm all old files
"""
for
i
in
files
:
if
os
.
path
.
exists
(
i
):
os
.
remove
(
i
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
code_new/Sumit/read_data.py
+
1
−
1
View file @
841b6d2e
...
@@ -340,5 +340,5 @@ def read_config_file(parser):
...
@@ -340,5 +340,5 @@ def read_config_file(parser):
else
:
else
:
nm_mock
=
None
nm_mock
=
None
res
=
rootpath
,
simulation_path_1
,
simulation_path_2
,
metadata_file
,
simulation_number
,
output_folder
,
export
,
overwrite
,
sampler
,
nr_code
,
nbcores
,
tshift
,
tend
,
t_align
,
nmax
,
npoints
,
model
,
error_str
,
fitnoise
,
l_int
,
index_mass
,
index_spin
,
error_type
,
error_val
,
af
,
mf
,
tau_var_str
,
nm_mock
res
=
rootpath
,
simulation_path_1
,
simulation_path_2
,
metadata_file
,
simulation_number
,
output_folder
,
export
,
overwrite
,
sampler
,
nr_code
,
nbcores
,
tshift
,
tend
,
t_align
,
nmax
,
npoints
,
model
,
error_str
,
fitnoise
,
l_int
,
index_mass
,
index_spin
,
error_type
,
error_val
,
af
,
mf
,
tau_var_str
,
nm_mock
,
downfactor
return
res
return
res
\ 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