mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-06-29 16:29:27 +02:00
Compare commits
No commits in common. "develop" and "v2.14.0" have entirely different histories.
6 changed files with 15 additions and 8 deletions
2
.github/workflows/pytest.yml
vendored
2
.github/workflows/pytest.yml
vendored
|
@ -43,4 +43,4 @@ jobs:
|
||||||
uv pip freeze --system
|
uv pip freeze --system
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: pytest --cov=pyerrors -vv -Werror
|
run: pytest --cov=pyerrors -vv
|
||||||
|
|
|
@ -151,7 +151,7 @@
|
||||||
"\n",
|
"\n",
|
||||||
"$$C_{\\textrm{projected}}(t)=v_1^T \\underline{C}(t) v_2$$\n",
|
"$$C_{\\textrm{projected}}(t)=v_1^T \\underline{C}(t) v_2$$\n",
|
||||||
"\n",
|
"\n",
|
||||||
"If we choose the vectors to be $v_1=v_2=(1,0,0,0)$, we should get the same correlator as in the cell above. \n",
|
"If we choose the vectors to be $v_1=v_2=(0,1,0,0)$, we should get the same correlator as in the cell above. \n",
|
||||||
"\n",
|
"\n",
|
||||||
"Thinking about it this way is usefull in the Context of the generalized eigenvalue problem (GEVP), used to find the source-sink combination, which best describes a certain energy eigenstate.\n",
|
"Thinking about it this way is usefull in the Context of the generalized eigenvalue problem (GEVP), used to find the source-sink combination, which best describes a certain energy eigenstate.\n",
|
||||||
"A good introduction is found in https://arxiv.org/abs/0902.1265."
|
"A good introduction is found in https://arxiv.org/abs/0902.1265."
|
||||||
|
|
|
@ -571,6 +571,7 @@ def _ol_from_dict(ind, reps='DICTOBS'):
|
||||||
counter = 0
|
counter = 0
|
||||||
|
|
||||||
def dict_replace_obs(d):
|
def dict_replace_obs(d):
|
||||||
|
nonlocal ol
|
||||||
nonlocal counter
|
nonlocal counter
|
||||||
x = {}
|
x = {}
|
||||||
for k, v in d.items():
|
for k, v in d.items():
|
||||||
|
@ -591,6 +592,7 @@ def _ol_from_dict(ind, reps='DICTOBS'):
|
||||||
return x
|
return x
|
||||||
|
|
||||||
def list_replace_obs(li):
|
def list_replace_obs(li):
|
||||||
|
nonlocal ol
|
||||||
nonlocal counter
|
nonlocal counter
|
||||||
x = []
|
x = []
|
||||||
for e in li:
|
for e in li:
|
||||||
|
@ -611,6 +613,7 @@ def _ol_from_dict(ind, reps='DICTOBS'):
|
||||||
return x
|
return x
|
||||||
|
|
||||||
def obslist_replace_obs(li):
|
def obslist_replace_obs(li):
|
||||||
|
nonlocal ol
|
||||||
nonlocal counter
|
nonlocal counter
|
||||||
il = []
|
il = []
|
||||||
for e in li:
|
for e in li:
|
||||||
|
@ -691,6 +694,7 @@ def _od_from_list_and_dict(ol, ind, reps='DICTOBS'):
|
||||||
|
|
||||||
def dict_replace_string(d):
|
def dict_replace_string(d):
|
||||||
nonlocal counter
|
nonlocal counter
|
||||||
|
nonlocal ol
|
||||||
x = {}
|
x = {}
|
||||||
for k, v in d.items():
|
for k, v in d.items():
|
||||||
if isinstance(v, dict):
|
if isinstance(v, dict):
|
||||||
|
@ -706,6 +710,7 @@ def _od_from_list_and_dict(ol, ind, reps='DICTOBS'):
|
||||||
|
|
||||||
def list_replace_string(li):
|
def list_replace_string(li):
|
||||||
nonlocal counter
|
nonlocal counter
|
||||||
|
nonlocal ol
|
||||||
x = []
|
x = []
|
||||||
for e in li:
|
for e in li:
|
||||||
if isinstance(e, list):
|
if isinstance(e, list):
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import warnings
|
import warnings
|
||||||
import gzip
|
import gzip
|
||||||
import sqlite3
|
import sqlite3
|
||||||
from contextlib import closing
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
from ..obs import Obs
|
from ..obs import Obs
|
||||||
from ..correlators import Corr
|
from ..correlators import Corr
|
||||||
|
@ -30,8 +29,9 @@ def to_sql(df, table_name, db, if_exists='fail', gz=True, **kwargs):
|
||||||
None
|
None
|
||||||
"""
|
"""
|
||||||
se_df = _serialize_df(df, gz=gz)
|
se_df = _serialize_df(df, gz=gz)
|
||||||
with closing(sqlite3.connect(db)) as con:
|
con = sqlite3.connect(db)
|
||||||
se_df.to_sql(table_name, con=con, if_exists=if_exists, index=False, **kwargs)
|
se_df.to_sql(table_name, con, if_exists=if_exists, index=False, **kwargs)
|
||||||
|
con.close()
|
||||||
|
|
||||||
|
|
||||||
def read_sql(sql, db, auto_gamma=False, **kwargs):
|
def read_sql(sql, db, auto_gamma=False, **kwargs):
|
||||||
|
@ -52,8 +52,9 @@ def read_sql(sql, db, auto_gamma=False, **kwargs):
|
||||||
data : pandas.DataFrame
|
data : pandas.DataFrame
|
||||||
Dataframe with the content of the sqlite database.
|
Dataframe with the content of the sqlite database.
|
||||||
"""
|
"""
|
||||||
with closing(sqlite3.connect(db)) as con:
|
con = sqlite3.connect(db)
|
||||||
extract_df = pd.read_sql(sql, con=con, **kwargs)
|
extract_df = pd.read_sql(sql, con, **kwargs)
|
||||||
|
con.close()
|
||||||
return _deserialize_df(extract_df, auto_gamma=auto_gamma)
|
return _deserialize_df(extract_df, auto_gamma=auto_gamma)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
__version__ = "2.15.0-dev"
|
__version__ = "2.14.0"
|
||||||
|
|
1
setup.py
1
setup.py
|
@ -30,6 +30,7 @@ setup(name='pyerrors',
|
||||||
classifiers=[
|
classifiers=[
|
||||||
'Development Status :: 5 - Production/Stable',
|
'Development Status :: 5 - Production/Stable',
|
||||||
'Intended Audience :: Science/Research',
|
'Intended Audience :: Science/Research',
|
||||||
|
'License :: OSI Approved :: MIT License',
|
||||||
'Programming Language :: Python :: 3',
|
'Programming Language :: Python :: 3',
|
||||||
'Programming Language :: Python :: 3.9',
|
'Programming Language :: Python :: 3.9',
|
||||||
'Programming Language :: Python :: 3.10',
|
'Programming Language :: Python :: 3.10',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue