Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/test warnings #395

Merged
merged 4 commits into from
Jan 28, 2025
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
6 changes: 3 additions & 3 deletions .github/workflows/validate-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ jobs:
id: has_mechanisms_dir
uses: andstor/file-existence-action@v1
with:
files: bmtk/tests/simulator/bionet/components/mechanisms
files: tests/simulator/bionet/components/mechanisms

- name: Setup NEURON
if: steps.has_mechanisms_dir.outputs.files_exists == 'true'
run: |
cd bmtk/tests/simulator/bionet/components/mechanisms
cd tests/simulator/bionet/components/mechanisms
nrnivmodl modfiles

- name: Run Tests
run: |
pytest --cov=bmtk --cov-report=html bmtk/tests
pytest --cov=bmtk --cov-report=html tests

linter:
runs-on: ${{ matrix.os }}
Expand Down
9 changes: 5 additions & 4 deletions bmtk/builder/index_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def create_index_in_memory(edges_file, edges_population, index_type, force_rebui
del edges_pop_grp[index_grp_name]

index_grp = edges_pop_grp.create_group(index_grp_name)
ids_array = np.array(edges_pop_grp[col_to_index]) # ids to be indexed
ids_array = np.array(edges_pop_grp[col_to_index][()]) # ids to be indexed
total_edges = len(edges_pop_grp[col_to_index])

if total_edges == 0:
Expand Down Expand Up @@ -202,11 +202,12 @@ def create_index_on_disk(edges_file, edges_population, index_type, force_rebuild

# fill in missing ids and foward fill Nans with the last previous index index
i2r_table_df = i2r_table_df.reindex(pd.RangeIndex(i2r_table_df.index.max() + 1))
i2r_table_df['range_end'] = i2r_table_df['range_end'].fillna(method='ffill')
i2r_table_df['range_end'].fillna(0, inplace=True)
i2r_table_df['range_end'] = i2r_table_df['range_end'].ffill()
i2r_table_df.fillna({'range_end': 0}, inplace=True)

nans_mask = i2r_table_df['range_beg'].isna()
i2r_table_df['range_beg'][nans_mask] = i2r_table_df['range_end'][nans_mask]
# i2r_table_df['range_beg'][nans_mask] = i2r_table_df['range_end'][nans_mask]
i2r_table_df.loc[nans_mask, 'range_beg'] = i2r_table_df['range_end'][nans_mask]

# Save partition to disk
partition_grp = cache_grp.create_group(partition_grp_name)
Expand Down
2 changes: 1 addition & 1 deletion bmtk/builder/network_adaptors/nxnetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from .network import Network


class NxNetwork(Network):
class NxNetwork(Network): # pragma: no cover
def __init__(self, name, **network_props):
super(NxNetwork, self).__init__(name, **network_props or {})

Expand Down
4 changes: 2 additions & 2 deletions bmtk/utils/sonata/edge_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def edge_props_distribution(edge_files, edge_prop, populations=None,
edges_df = pd.merge(edges_df, trg_nodes_df, how='left', on='target_node_id')

if fill_val is not False:
edges_df[edge_prop] = fill_val if edge_prop not in edges_df.columns else edges_df[edge_prop].fillna(fill_val)
edges_df[edge_prop] = fill_val if edge_prop not in edges_df.columns else edges_df[edge_prop].infer_objects().fillna(fill_val)

grouping_cols = edge_props_grouping + source_props_grouping + target_props_grouping
if not grouping_cols:
Expand Down Expand Up @@ -431,7 +431,7 @@ def edge_stats_table(edges_data):
n_trg_nodes = edges_df['target_node_id'].nunique()
n_edge_types = edges_df.pop('edge_type_id').nunique()

edges_df['nsyns'] = 1 if 'nsyns' not in edges_df.columns else edges_df['nsyns'].fillna(1)
edges_df['nsyns'] = 1 if 'nsyns' not in edges_df.columns else edges_df['nsyns'].infer_objects().fillna(1)
conns_se = edges_df.groupby(['source_node_id', 'target_node_id'])['nsyns'].agg('sum')
n_conns = len(conns_se)
n_syns = np.sum(conns_se.values)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading