hedvis configuration classes

Visualization configuration

Configuration classes for HED visualizations.

class hedvis.core.visualization_config.WordCloudConfig(width: int = 800, height: int = 600, background_color: str | None = None, prefer_horizontal: float = 0.75, min_font_size: int = 8, max_font_size: int | None = None, font_path: str | None = None, colormap: str = 'nipy_spectral', color_range: tuple = (0.0, 0.5), color_step_range: tuple = (0.15, 0.25), use_mask: bool = False, mask_path: str | None = None, contour_width: float = 3.0, contour_color: str = 'black', scale_adjustment: float = 0.0, relative_scaling: float = 1.0)[source]

Bases: object

Configuration for word cloud visualizations.

width

Width of word cloud in pixels.

Type:

int

height

Height of word cloud in pixels.

Type:

int

background_color

Background color name or None for transparent.

Type:

str | None

prefer_horizontal

Fraction of words oriented horizontally (0.0-1.0).

Type:

float

min_font_size

Minimum font size in points.

Type:

int

max_font_size

Maximum font size in points (auto-calculated if None).

Type:

int | None

font_path

Path to TTF/OTF font file (None uses default).

Type:

str | None

colormap

Matplotlib colormap name for word colors.

Type:

str

color_range

Tuple of (min, max) values from colormap to use.

Type:

tuple

color_step_range

Tuple of (min, max) step sizes through colormap.

Type:

tuple

use_mask

Whether to use a mask image to shape the cloud.

Type:

bool

mask_path

Path to mask image file (PNG/JPEG).

Type:

str | None

contour_width

Width of contour line around masked region.

Type:

float

contour_color

Color name for contour line.

Type:

str

scale_adjustment

Adjustment factor for log-transformed frequencies.

Type:

float

relative_scaling

Scaling factor for word sizes (0.0-1.0).

Type:

float

width: int = 800
height: int = 600
background_color: str | None = None
prefer_horizontal: float = 0.75
min_font_size: int = 8
max_font_size: int | None = None
font_path: str | None = None
colormap: str = 'nipy_spectral'
color_range: tuple = (0.0, 0.5)
color_step_range: tuple = (0.15, 0.25)
use_mask: bool = False
mask_path: str | None = None
contour_width: float = 3.0
contour_color: str = 'black'
scale_adjustment: float = 0.0
relative_scaling: float = 1.0
classmethod from_dict(config_dict: Dict[str, Any]) WordCloudConfig[source]

Create configuration from dictionary.

Parameters:

config_dict – Dictionary with configuration parameters.

Returns:

Configuration object.

Return type:

WordCloudConfig

to_dict() Dict[str, Any][source]

Convert configuration to dictionary.

Returns:

Dictionary representation of configuration.

Return type:

dict

__init__(width: int = 800, height: int = 600, background_color: str | None = None, prefer_horizontal: float = 0.75, min_font_size: int = 8, max_font_size: int | None = None, font_path: str | None = None, colormap: str = 'nipy_spectral', color_range: tuple = (0.0, 0.5), color_step_range: tuple = (0.15, 0.25), use_mask: bool = False, mask_path: str | None = None, contour_width: float = 3.0, contour_color: str = 'black', scale_adjustment: float = 0.0, relative_scaling: float = 1.0) None
class hedvis.core.visualization_config.VisualizationConfig(output_formats: ~typing.List[str] = <factory>, save_directory: str | None = None, word_cloud: ~hedvis.core.visualization_config.WordCloudConfig | None = None)[source]

Bases: object

Master configuration for all HED visualizations.

output_formats

List of output formats (‘svg’, ‘png’, ‘jpg’, etc.).

Type:

List[str]

save_directory

Directory path for saving visualizations (None = don’t save).

Type:

str | None

word_cloud

Configuration for word cloud visualization (None = don’t generate).

Type:

hedvis.core.visualization_config.WordCloudConfig | None

output_formats: List[str]
save_directory: str | None = None
word_cloud: WordCloudConfig | None = None
classmethod from_dict(config_dict: Dict[str, Any]) VisualizationConfig[source]

Create configuration from dictionary.

Parameters:

config_dict – Dictionary with configuration parameters.

Returns:

Configuration object.

Return type:

VisualizationConfig

Notes

Nested dictionaries are automatically converted to appropriate config objects.

to_dict() Dict[str, Any][source]

Convert configuration to dictionary.

Returns:

Dictionary representation of configuration.

Return type:

dict

__init__(output_formats: ~typing.List[str] = <factory>, save_directory: str | None = None, word_cloud: ~hedvis.core.visualization_config.WordCloudConfig | None = None) None

VisualizationConfig

class hedvis.core.visualization_config.VisualizationConfig(output_formats: ~typing.List[str] = <factory>, save_directory: str | None = None, word_cloud: ~hedvis.core.visualization_config.WordCloudConfig | None = None)[source]

Bases: object

Master configuration for all HED visualizations.

output_formats

List of output formats (‘svg’, ‘png’, ‘jpg’, etc.).

Type:

List[str]

save_directory

Directory path for saving visualizations (None = don’t save).

Type:

str | None

word_cloud

Configuration for word cloud visualization (None = don’t generate).

Type:

hedvis.core.visualization_config.WordCloudConfig | None

Main configuration class for visualization generation.

Attributes:

  • word_cloud (WordCloudConfig) - Word cloud settings

  • output_formats (list) - List of output formats [‘png’, ‘svg’]

  • save_directory (str) - Directory for saving outputs

  • save_files (bool) - Whether to automatically save files

Example:

from hedvis import VisualizationConfig, WordCloudConfig

config = VisualizationConfig(
    word_cloud=WordCloudConfig(width=1000, height=600),
    output_formats=["png", "svg"],
    save_directory="./outputs",
    save_files=True
)

From dictionary:

config_dict = {
    "word_cloud": {"width": 800, "height": 600},
    "output_formats": ["svg"]
}
config = VisualizationConfig.from_dict(config_dict)
output_formats: List[str]
save_directory: str | None = None
word_cloud: WordCloudConfig | None = None
classmethod from_dict(config_dict: Dict[str, Any]) VisualizationConfig[source]

Create configuration from dictionary.

Parameters:

config_dict – Dictionary with configuration parameters.

Returns:

Configuration object.

Return type:

VisualizationConfig

Notes

Nested dictionaries are automatically converted to appropriate config objects.

to_dict() Dict[str, Any][source]

Convert configuration to dictionary.

Returns:

Dictionary representation of configuration.

Return type:

dict

__init__(output_formats: ~typing.List[str] = <factory>, save_directory: str | None = None, word_cloud: ~hedvis.core.visualization_config.WordCloudConfig | None = None) None

WordCloudConfig

class hedvis.core.visualization_config.WordCloudConfig(width: int = 800, height: int = 600, background_color: str | None = None, prefer_horizontal: float = 0.75, min_font_size: int = 8, max_font_size: int | None = None, font_path: str | None = None, colormap: str = 'nipy_spectral', color_range: tuple = (0.0, 0.5), color_step_range: tuple = (0.15, 0.25), use_mask: bool = False, mask_path: str | None = None, contour_width: float = 3.0, contour_color: str = 'black', scale_adjustment: float = 0.0, relative_scaling: float = 1.0)[source]

Bases: object

Configuration for word cloud visualizations.

width

Width of word cloud in pixels.

Type:

int

height

Height of word cloud in pixels.

Type:

int

background_color

Background color name or None for transparent.

Type:

str | None

prefer_horizontal

Fraction of words oriented horizontally (0.0-1.0).

Type:

float

min_font_size

Minimum font size in points.

Type:

int

max_font_size

Maximum font size in points (auto-calculated if None).

Type:

int | None

font_path

Path to TTF/OTF font file (None uses default).

Type:

str | None

colormap

Matplotlib colormap name for word colors.

Type:

str

color_range

Tuple of (min, max) values from colormap to use.

Type:

tuple

color_step_range

Tuple of (min, max) step sizes through colormap.

Type:

tuple

use_mask

Whether to use a mask image to shape the cloud.

Type:

bool

mask_path

Path to mask image file (PNG/JPEG).

Type:

str | None

contour_width

Width of contour line around masked region.

Type:

float

contour_color

Color name for contour line.

Type:

str

scale_adjustment

Adjustment factor for log-transformed frequencies.

Type:

float

relative_scaling

Scaling factor for word sizes (0.0-1.0).

Type:

float

Configuration for word cloud visualizations.

Dimension Attributes:

  • width (int) - Width in pixels (default: 800)

  • height (int) - Height in pixels (default: 600)

Appearance Attributes:

  • background_color (str or None) - Background color (None for transparent)

  • prefer_horizontal (float) - Fraction of horizontal text (0.0-1.0)

  • min_font_size (int) - Minimum font size

  • max_font_size (int or None) - Maximum font size (auto if None)

Font Attributes:

  • font_path (str or None) - Path to custom font file (.ttf, .otf)

Color Scheme Attributes:

  • colormap (str) - Matplotlib colormap name (default: ‘nipy_spectral’)

  • color_range (tuple) - (min, max) range of colormap to use

  • color_step_range (tuple) - (min, max) step sizes through colormap

Mask Attributes:

  • use_mask (bool) - Whether to use mask image

  • mask_path (str or None) - Path to mask image

  • contour_width (int) - Width of contour line

  • contour_color (str) - Color of contour line

Scaling Attributes:

  • scale_adjustment (float) - Frequency scaling adjustment

  • relative_scaling (float) - Word size scaling factor (0.0-1.0)

Example:

Basic configuration:

from hedvis import WordCloudConfig

config = WordCloudConfig(
    width=1200,
    height=800,
    background_color="white",
    colormap="viridis"
)

Masked word cloud:

config = WordCloudConfig(
    use_mask=True,
    mask_path="brain_outline.png",
    background_color="white",
    contour_width=3,
    contour_color="navy"
)

Custom colors and fonts:

config = WordCloudConfig(
    font_path="/path/to/custom-font.ttf",
    colormap="plasma",
    color_range=(0.2, 0.8),
    prefer_horizontal=0.9
)
width: int = 800
height: int = 600
background_color: str | None = None
prefer_horizontal: float = 0.75
min_font_size: int = 8
max_font_size: int | None = None
font_path: str | None = None
colormap: str = 'nipy_spectral'
color_range: tuple = (0.0, 0.5)
color_step_range: tuple = (0.15, 0.25)
use_mask: bool = False
mask_path: str | None = None
contour_width: float = 3.0
contour_color: str = 'black'
scale_adjustment: float = 0.0
relative_scaling: float = 1.0
classmethod from_dict(config_dict: Dict[str, Any]) WordCloudConfig[source]

Create configuration from dictionary.

Parameters:

config_dict – Dictionary with configuration parameters.

Returns:

Configuration object.

Return type:

WordCloudConfig

to_dict() Dict[str, Any][source]

Convert configuration to dictionary.

Returns:

Dictionary representation of configuration.

Return type:

dict

__init__(width: int = 800, height: int = 600, background_color: str | None = None, prefer_horizontal: float = 0.75, min_font_size: int = 8, max_font_size: int | None = None, font_path: str | None = None, colormap: str = 'nipy_spectral', color_range: tuple = (0.0, 0.5), color_step_range: tuple = (0.15, 0.25), use_mask: bool = False, mask_path: str | None = None, contour_width: float = 3.0, contour_color: str = 'black', scale_adjustment: float = 0.0, relative_scaling: float = 1.0) None