New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

singlecase

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

singlecase - pypi Package Compare versions

Comparing version
0.2.1
to
0.2.2
+75
singlecase/plotting/__init__.py
from typing import List, Tuple
import matplotlib.pyplot as plt
from singlecase.data import Data
def line_chart(data: Data, dvars: List[str] = None, num_per_row: int = 1, phases: List[str] = None, figure_size: Tuple[int, int] = (10, 8), y_range: Tuple[float, float] = None, title: str = None, filename=None, dpi=300):
"""
Plot the selected dependent variables on a line chart, with separate colors for each phase.
Args:
data (Data): The singlecase data to plot.
dvars (List[str]): The dependent variables to plot. If None, all dependent variables are plotted.
num_per_row (int): Number of plots per row. Default is 1.
phases (List[str]): The phases to plot. If None, all phases are plotted.
figure_size (Tuple[int, int]): The size of the figure. Default is (10, 8).
title (str): The title of the plot. Default is None.
"""
if dvars is None:
dvars = data.dvars
if phases is None:
phases = data.phases
phase_colors = plt.get_cmap('tab10', len(phases))
rows = (len(dvars) - 1) // num_per_row + 1
fig = plt.figure(figsize=figure_size, dpi=dpi)
if title is not None:
fig.suptitle(title)
# Get the min_y and max_y across all dvars and phases
if y_range is None:
min_y = min(data.phase_data(phase, dvar).min() for phase in phases for dvar in dvars)
max_y = max(data.phase_data(phase, dvar).max() for phase in phases for dvar in dvars)
else:
min_y, max_y = y_range
y_diff = max_y - min_y
min_y -= y_diff * 0.05
max_y += y_diff * 0.05
xnames = list(data._df.index)
for idx, dvar in enumerate(dvars):
ax = fig.add_subplot(rows, num_per_row, idx + 1)
for i, phase in enumerate(phases):
phase_data = data.phase_data(phase, dvar)
ax.scatter(phase_data.index, phase_data, color=phase_colors(i), zorder=3)
phase_data = phase_data.interpolate()
ax.plot(phase_data, label=f"Phase: {phase}", color=phase_colors(i), zorder=3)
ax.set_ylim(min_y, max_y)
if data.dvar_units[dvar] != "":
ax.set_ylabel(data.dvar_units[dvar])
ax.set_xlabel(data.index)
ax.set_xticks(range(len(xnames)))
ax.set_xticklabels(xnames)
ax.set_title(f'{dvar}')
# Only add legend if there is more than one phase
if len(phases) > 1:
ax.legend()
plt.tight_layout()
if filename is not None:
plt.savefig(filename)
else:
plt.show()
+15
-4
Metadata-Version: 2.1
Name: singlecase
Version: 0.2.1
Summary: A tool for single-case design data managment, statistical analysis and visualization.
Version: 0.2.2
Summary: A tool for single-case design data management, statistical analysis and visualization.
Author-email: Casper Wilstrup <casper.wilstrup@abzu.ai>

@@ -42,2 +42,4 @@ License: BSD 3-Clause License

Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Intended Audience :: Science/Research

@@ -52,9 +54,18 @@ Classifier: Intended Audience :: Healthcare Industry

Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: pandas
Requires-Dist: scipy
Requires-Dist: matplotlib
Provides-Extra: dev
License-File: LICENSE
Requires-Dist: black; extra == "dev"
Requires-Dist: pip-tools; extra == "dev"
Requires-Dist: pytest; extra == "dev"
# Single Case Research Package
The Single Case Research package is a Python library designed to assist in conducting single-case research studies. The package provides tools to analyze single-case data sets. It is designed for simplicity and ease of use, with a range of methods to calculate various statistical measures for single-case data sets. The package is perfect for analysts and researchers dealing with single-case designs, providing a framework to load, manage, and manipulate such data, along with robust statistical functions to interpret the data.
*By Casper Wilstrup*
The Single Case Research package is a Python library designed to assist in conducting single-case research studies. The package provides tools to analyze single-case data sets. It is designed for simplicity and ease of use, with a range of methods to calculate various statistical measures for single-case data sets. The package is useful for analysts and researchers dealing with single-case designs, providing a framework to load, manage, and manipulate such data, along with robust statistical functions to interpret the data.
More functionality will be added as the package is further developed

@@ -61,0 +72,0 @@

@@ -11,4 +11,4 @@ [build-system]

name = "singlecase"
version = "0.2.1"
description = "A tool for single-case design data managment, statistical analysis and visualization."
version = "0.2.2"
description = "A tool for single-case design data management, statistical analysis and visualization."
readme = "README.md"

@@ -23,2 +23,4 @@ authors = [{ name = "Casper Wilstrup", email = "casper.wilstrup@abzu.ai" }]

"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Intended Audience :: Science/Research",

@@ -37,2 +39,3 @@ "Intended Audience :: Healthcare Industry",

"scipy",
"matplotlib",
]

@@ -39,0 +42,0 @@ requires-python = ">=3.8"

# Single Case Research Package
The Single Case Research package is a Python library designed to assist in conducting single-case research studies. The package provides tools to analyze single-case data sets. It is designed for simplicity and ease of use, with a range of methods to calculate various statistical measures for single-case data sets. The package is perfect for analysts and researchers dealing with single-case designs, providing a framework to load, manage, and manipulate such data, along with robust statistical functions to interpret the data.
*By Casper Wilstrup*
The Single Case Research package is a Python library designed to assist in conducting single-case research studies. The package provides tools to analyze single-case data sets. It is designed for simplicity and ease of use, with a range of methods to calculate various statistical measures for single-case data sets. The package is useful for analysts and researchers dealing with single-case designs, providing a framework to load, manage, and manipulate such data, along with robust statistical functions to interpret the data.
More functionality will be added as the package is further developed

@@ -6,0 +8,0 @@

Metadata-Version: 2.1
Name: singlecase
Version: 0.2.1
Summary: A tool for single-case design data managment, statistical analysis and visualization.
Version: 0.2.2
Summary: A tool for single-case design data management, statistical analysis and visualization.
Author-email: Casper Wilstrup <casper.wilstrup@abzu.ai>

@@ -42,2 +42,4 @@ License: BSD 3-Clause License

Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Intended Audience :: Science/Research

@@ -52,9 +54,18 @@ Classifier: Intended Audience :: Healthcare Industry

Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: pandas
Requires-Dist: scipy
Requires-Dist: matplotlib
Provides-Extra: dev
License-File: LICENSE
Requires-Dist: black; extra == "dev"
Requires-Dist: pip-tools; extra == "dev"
Requires-Dist: pytest; extra == "dev"
# Single Case Research Package
The Single Case Research package is a Python library designed to assist in conducting single-case research studies. The package provides tools to analyze single-case data sets. It is designed for simplicity and ease of use, with a range of methods to calculate various statistical measures for single-case data sets. The package is perfect for analysts and researchers dealing with single-case designs, providing a framework to load, manage, and manipulate such data, along with robust statistical functions to interpret the data.
*By Casper Wilstrup*
The Single Case Research package is a Python library designed to assist in conducting single-case research studies. The package provides tools to analyze single-case data sets. It is designed for simplicity and ease of use, with a range of methods to calculate various statistical measures for single-case data sets. The package is useful for analysts and researchers dealing with single-case designs, providing a framework to load, manage, and manipulate such data, along with robust statistical functions to interpret the data.
More functionality will be added as the package is further developed

@@ -61,0 +72,0 @@

numpy
pandas
scipy
matplotlib

@@ -5,0 +6,0 @@ [dev]

@@ -14,2 +14,3 @@ LICENSE

singlecase/permtest/__init__.py
singlecase/plotting/__init__.py
singlecase/table/__init__.py
from . import data
from . import effectsize
from . import permtest
from . import table
from . import plotting

@@ -5,0 +7,0 @@ from .data import Data

@@ -28,3 +28,3 @@ from typing import Union, Dict, List

def __init__(self, data: Union[pd.DataFrame, Dict], pvar: str=None, index: str = None):
def __init__(self, data: Union[pd.DataFrame, Dict], pvar: str=None, index: str = None, units: Union[Dict[str, str], str] = None):
"""

@@ -48,2 +48,6 @@ Constructs and initializes the Data object.

pvar = "phase"
else:
self._df["phase"] = "default"
pvar = "phase"
else:

@@ -58,3 +62,23 @@ if pvar not in self._df.columns:

if units is None:
units = {dvar: "" for dvar in self._dvars}
elif isinstance(units, str):
units = {dvar: units for dvar in self._dvars}
elif not isinstance(units, dict):
raise ValueError("units of dependent variables must be a dict or a str")
self._dvar_units = units
@property
def index(self) -> str:
"""
Property that gets the name of the index variable of the Data object.
Returns:
str: The name of the index column.
"""
return self._df.index.name
@property
def pvar(self):

@@ -95,2 +119,12 @@ """

@property
def dvar_units(self) -> Dict[str, str]:
"""
Property that gets the units of the dependent variables.
Returns:
Dict[str, str]: A dictionary mapping the dependent variable names to their units.
"""
return self._dvar_units
@property
def dvars(self):

@@ -97,0 +131,0 @@ """

@@ -10,3 +10,3 @@ from singlecase.data import Data

"""
pass
return data._df.T