Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion invisible_cities/cities/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -1610,7 +1610,7 @@ def create_extract_track_blob_info(hits: pd.DataFrame) -> Tuple[pd.DataFrame, pd
hits = hits.assign(track_id=-1)
if len(hits) > max_num_hits:
event = hits.event.iloc[0]
warn("Event {event} has too many hits ({len(hits)})."
warn(f"Event {event} has too many hits ({len(hits)})."
" This event will not be processed.")
return df, hits, True
plf.round_hits_positions_in_place(hits, 5)
Expand Down
1 change: 1 addition & 0 deletions invisible_cities/cities/esmeralda_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ def test_esmeralda_all_hits_after_drop_voxels(esmeralda_config, Th228_hits, conf

#TODO: refactor paolina to include this as a filter
@ignore_warning.no_config_group
@ignore_warning.too_many_hits
def test_esmeralda_filters_events_with_too_many_hits(esmeralda_config, Th228_tracks, config_tmpdir):
path_out = os.path.join(config_tmpdir, "esmeralda_filters_events_with_too_many_hits.h5")
nevt_req = 2
Expand Down
2 changes: 2 additions & 0 deletions invisible_cities/cities/isaura_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@

@ignore_warning.no_config_group
@ignore_warning.not_kdst
@ignore_warning.too_many_hits
def test_isaura_contains_all_tables(ICDATADIR, output_tmpdir):

PATH_IN = os.path.join(ICDATADIR , "test_Xe2nu_NEW_exact_deconvolution_joint.NEWMC.h5")
PATH_OUT = os.path.join(output_tmpdir, "contain_all_tables.isaura.h5")
conf = configure('isaura $ICTDIR/invisible_cities/config/isaura.conf'.split())
conf.update(dict(files_in = PATH_IN ,
file_out = PATH_OUT))

isaura(**conf)

tables = ["Tracking/Tracks" ,
Expand Down
1 change: 1 addition & 0 deletions invisible_cities/core/testing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,4 @@ class ignore_warning:
max_time_short = mark.filterwarnings("ignore:`max_time` shorter than `buffer_length`")
no_mc_tables = mark.filterwarnings("ignore:File does not contain MC tables.( *)Use positve run numbers for data")
fit_covariance = mark.filterwarnings("ignore:Covariance of the parameters could not be estimated")
too_many_hits = mark.filterwarnings("ignore:Event .* has too many hits")
2 changes: 1 addition & 1 deletion invisible_cities/database/db_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ def connect_sqlite(dbfile):
@mark.skip(reason='server timeouts cause too many spurious test failures')
def connect_mysql(dbname):
conn_mysql = pymysql.connect(host="next.ific.uv.es",
user='nextreader',passwd='readonly', db=dbname)
user='nextreader', password='readonly', database=dbname)
cursor_mysql = conn_mysql .cursor()
return connect_mysql, cursor_mysql
5 changes: 2 additions & 3 deletions invisible_cities/database/download_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_create_table_sqlite(dbname, output_tmpdir):

connSqlite = sqlite3.connect(dbfile)
connMySql = pymysql.connect(host="next.ific.uv.es",
user='nextreader',passwd='readonly', db=dbname)
user='nextreader', password='readonly', database=dbname)

cursorMySql = connMySql .cursor()
cursorSqlite = connSqlite.cursor()
Expand All @@ -42,7 +42,7 @@ def test_table_assignment(dbname):
@mark.parametrize('dbname', db.dbnames)
def test_tables_exist(dbname):
connMySql = pymysql.connect(host="next.ific.uv.es",
user='nextreader',passwd='readonly', db=dbname)
user='nextreader', password='readonly', database=dbname)

cursor = connMySql.cursor()
cursor.execute("Show tables;")
Expand All @@ -51,4 +51,3 @@ def test_tables_exist(dbname):
for name in db.table_dict[dbname]:
assert (name,) in available


4 changes: 2 additions & 2 deletions invisible_cities/icaros/control_plots_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,8 @@ def monitor_dtime(df : pd.DataFrame,
axs[1,0].set_xlabel(r"Drift time ($\mu$s)");
axs[1,0].grid(True)

axs[1,1].hist(df1_.Zrms**2, 100, (0, 40), histtype = 'step',color = 'mediumpurple',lw = 2, label = 'before selection');
axs[1,1].hist(df2.Zrms**2, 100, (0, 40), histtype = 'step', color = 'black',lw = 2, label = 'after selection');
axs[1,1].hist(df1_.Zrms**2, bins = 100, range = (0, 40), histtype = 'step',color = 'mediumpurple',lw = 2, label = 'before selection');
axs[1,1].hist(df2.Zrms**2, bins = 100, range = (0, 40), histtype = 'step', color = 'black',lw = 2, label = 'after selection');
axs[1,1].legend();
axs[1,1].set_xlabel(r"DT$_{rms}^2$ ($\mu$s)");
axs[1,1].grid(True)
Expand Down
13 changes: 10 additions & 3 deletions invisible_cities/icaros/krmap_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
functions to get and store map info (metadata) and time evolution.
"""
import itertools
import warnings

import pandas as pd
import numpy as np
Expand Down Expand Up @@ -711,9 +712,15 @@ def save_map(name : str,
-------
Hdf file containing in each node each one of the inputs.
"""
#special case, mode = 'w' because if you process the same data twice and mode = 'a'
#the map would be duplicated.
metadata.to_hdf(name, key = 'metadata', mode = 'w')
# Special case, mode = 'w' because if you process the same data twice and mode = 'a'
# the map would be duplicated.
#
# Metadata intentionally mixes scalar and list-valued entries. Pandas must
# pickle this small heterogeneous object column in the fixed-format HDF5
# store, so silence the corresponding performance warning here.
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category = pd.errors.PerformanceWarning)
metadata.to_hdf(name, key = 'metadata', mode = 'w')

with tb.open_file(name, "a") as file:
df_writer(file, efficiencies, group_name = 'data', table_name = 'selection_efficiencies')
Expand Down
Loading