Closed matt-graham closed 3 months ago
Raising as part of JOSS review openjournals/joss-reviews/issues/6713
Currently the simdec.tableau function modifies the states list argument passed to the function in the for loop in lines
simdec.tableau
states
https://github.com/Simulation-Decomposition/simdec-python/blob/da28df6c981d5ac45f843a4b96fbfd227ed6604f/src/simdec/visualization.py#L228-L234
This results in a cryptic TypeError: slice indices must be integers or None or have an __index__ method error if calling simdec.palette subsequently on the same states argument, for example (running from root of repository)
TypeError: slice indices must be integers or None or have an __index__ method
simdec.palette
import numpy as np import pandas as pd import simdec as sd data = pd.read_csv("tests/data/stress.csv") output_name, *variable_names = list(data.columns) inputs, output = data[variable_names], data[output_name] sensitivity_analysis_result = sd.sensitivity_indices(inputs=inputs, output=output) decomposition_results = sd.decomposition( inputs=inputs, output=output, sensitivity_indices=sensitivity_analysis_result.first_order ) table, styler = sd.tableau( var_names=variable_names, statistic=decomposition_results.statistic, states=decomposition_results.states, bins=decomposition_results.bins, palette=sd.palette(decomposition_results.states) ) sd.palette(decomposition_results.states)
Thanks, good catch. Should be fixed with d0a3fb55d22694eab9ca48ebe4f991050ff43e20
Raising as part of JOSS review openjournals/joss-reviews/issues/6713
Currently the
simdec.tableau
function modifies thestates
list argument passed to the function in the for loop in lineshttps://github.com/Simulation-Decomposition/simdec-python/blob/da28df6c981d5ac45f843a4b96fbfd227ed6604f/src/simdec/visualization.py#L228-L234
This results in a cryptic
TypeError: slice indices must be integers or None or have an __index__ method
error if callingsimdec.palette
subsequently on the samestates
argument, for example (running from root of repository)