# jvlab/rs-software architecture

> Architecture diagram of the GitHub repository jvlab/rs-software, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jvlab/rs-software
- Repository: https://github.com/jvlab/rs-software

## Overview

rs-software is a toolkit for constructing representational spaces from similarity judgments and analyzing or comparing those spaces. The Python workflow accepts detailed ranking responses or combined choice files, prepares comparison data, fits geometric models, and produces coordinates and likelihood results; separate geometry and model-comparison capabilities support curved-space analysis. The repository also contains a substantial MATLAB implementation, but its internal wiring is not established by the supplied excerpts. Python edges below follow SOURCE INDEX references; MATLAB is shown as a documented product capability without inferred connections.

Main entry points: [`src/rs_py/model/fit_geometric_models.py`](https://github.com/jvlab/rs-software/blob/main/src/rs_py/model/fit_geometric_models.py) (Geometric model fitting), [`src/rs_py/scripts/model_fitting.py`](https://github.com/jvlab/rs-software/blob/main/src/rs_py/scripts/model_fitting.py) (Model fitting runner), [`src/rs_py/choices/choice_likelihoods.py`](https://github.com/jvlab/rs-software/blob/main/src/rs_py/choices/choice_likelihoods.py) (Choice likelihoods), [`src/rs_py/scripts/write_choice_file.py`](https://github.com/jvlab/rs-software/blob/main/src/rs_py/scripts/write_choice_file.py) (Combined choice writer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Judgment inputs"]
  node_choice_writer["Combined choice writer"]
  node_combined_choices["Combined choice files"]
  node_detailed_writer["Detailed choice writer"]
  node_detailed_choices["Detailed response parsing"]
end

subgraph group_fitting["Model fitting"]
  node_choice_likelihoods["Choice likelihoods"]
  node_fit_script["Model fitting runner<br/>[model_fitting.py]"]
  node_fit_models["Geometric model fitting"]
  node_compare_script["Curved-model runner"]
  node_compare_models["Curved-model comparison"]
end

subgraph group_geometry["Geometry and analysis"]
  node_euclidean["Euclidean geometry<br/>[euclidean.py]"]
  node_hyperbolic["Hyperbolic geometry<br/>[hyperbolic.py]"]
  node_spherical["Spherical geometry<br/>[spherical.py]"]
end

subgraph group_support["Shared utilities"]
  node_anchor["Coordinate anchoring"]
  node_mds["MDS initialization<br/>[mds_embedding.py]"]
  node_minimize["Optimization<br/>[minimize.py]"]
  node_util["Judgment utilities<br/>[util.py]"]
  node_helpers["Output helpers<br/>[helpers.py]"]
  node_config["Run configuration<br/>[config.py]"]
  node_logging["Logging<br/>[logging.py]"]
end

node_researcher(("Researcher"))
node_matlab["MATLAB toolkit"]

node_researcher -->|"prepares choices"| node_choice_writer
node_researcher -->|"prepares choices"| node_detailed_writer
node_researcher -->|"analyzes judgments"| node_fit_script
node_choice_writer -->|"reads settings"| node_config
node_choice_writer -->|"writes choice file"| node_combined_choices
node_detailed_writer -->|"reads settings"| node_config
node_detailed_writer -->|"writes choice file"| node_detailed_choices
node_detailed_choices -->|"uses helpers"| node_helpers
node_fit_script -->|"runs fitting"| node_fit_models
node_fit_script -->|"evaluates choices"| node_choice_likelihoods
node_fit_script -->|"loads settings"| node_config
node_fit_script -.->|"writes results"| node_helpers
node_fit_models -->|"uses geometry"| node_hyperbolic
node_fit_models -->|"uses geometry"| node_spherical
node_fit_models -->|"anchors coordinates"| node_anchor
node_fit_models -->|"seeds optimization"| node_mds
node_fit_models -->|"uses optimizer"| node_minimize
node_fit_models -->|"formats judgments"| node_util
node_fit_models -->|"scores fit"| node_choice_likelihoods
node_compare_script -->|"runs comparison"| node_compare_models
node_compare_models -->|"fits alternatives"| node_fit_models
node_choice_likelihoods -->|"uses coordinates"| node_anchor
node_choice_likelihoods -->|"uses utilities"| node_util
node_mds -->|"logs progress"| node_logging
node_fit_models -->|"logs progress"| node_logging

click node_choice_writer "https://github.com/jvlab/rs-software/blob/main/src/rs_py/scripts/write_choice_file.py"
click node_combined_choices "https://github.com/jvlab/rs-software/blob/main/src/rs_py/choices/choice_file_combined.py"
click node_detailed_writer "https://github.com/jvlab/rs-software/blob/main/src/rs_py/scripts/write_choice_file_detailed.py"
click node_detailed_choices "https://github.com/jvlab/rs-software/blob/main/src/rs_py/choices/choice_file_detailed.py"
click node_choice_likelihoods "https://github.com/jvlab/rs-software/blob/main/src/rs_py/choices/choice_likelihoods.py"
click node_fit_script "https://github.com/jvlab/rs-software/blob/main/src/rs_py/scripts/model_fitting.py"
click node_fit_models "https://github.com/jvlab/rs-software/blob/main/src/rs_py/model/fit_geometric_models.py"
click node_compare_script "https://github.com/jvlab/rs-software/blob/main/src/rs_py/scripts/run_curved_space_model_fitting.py"
click node_compare_models "https://github.com/jvlab/rs-software/blob/main/src/rs_py/model/compare_curved_space_models.py"
click node_euclidean "https://github.com/jvlab/rs-software/blob/main/src/rs_py/geometry/euclidean.py"
click node_hyperbolic "https://github.com/jvlab/rs-software/blob/main/src/rs_py/geometry/hyperbolic.py"
click node_spherical "https://github.com/jvlab/rs-software/blob/main/src/rs_py/geometry/spherical.py"
click node_anchor "https://github.com/jvlab/rs-software/blob/main/src/rs_py/utils/anchor_coordinates.py"
click node_mds "https://github.com/jvlab/rs-software/blob/main/src/rs_py/utils/mds_embedding.py"
click node_minimize "https://github.com/jvlab/rs-software/blob/main/src/rs_py/utils/minimize.py"
click node_util "https://github.com/jvlab/rs-software/blob/main/src/rs_py/utils/util.py"
click node_helpers "https://github.com/jvlab/rs-software/blob/main/src/rs_py/utils/helpers.py"
click node_config "https://github.com/jvlab/rs-software/blob/main/src/rs_py/utils/config.py"
click node_logging "https://github.com/jvlab/rs-software/blob/main/src/rs_py/utils/logging.py"
click node_matlab "https://github.com/jvlab/rs-software/tree/main/src"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_choice_writer,node_combined_choices,node_detailed_writer,node_detailed_choices toneBlue
class node_choice_likelihoods,node_fit_script,node_fit_models,node_compare_script,node_compare_models toneAmber
class node_euclidean,node_hyperbolic,node_spherical toneMint
class node_anchor,node_mds,node_minimize,node_util,node_helpers,node_config,node_logging toneRose
class node_researcher toneIndigo
class node_matlab toneTeal
```

## Components

### Judgment inputs

- [Combined choice writer](https://github.com/jvlab/rs-software/blob/main/src/rs_py/scripts/write_choice_file.py): `src/rs_py/scripts/write_choice_file.py`
- [Combined choice files](https://github.com/jvlab/rs-software/blob/main/src/rs_py/choices/choice_file_combined.py): `src/rs_py/choices/choice_file_combined.py`
- [Detailed choice writer](https://github.com/jvlab/rs-software/blob/main/src/rs_py/scripts/write_choice_file_detailed.py): `src/rs_py/scripts/write_choice_file_detailed.py`
- [Detailed response parsing](https://github.com/jvlab/rs-software/blob/main/src/rs_py/choices/choice_file_detailed.py): `src/rs_py/choices/choice_file_detailed.py`

### Model fitting

- [Choice likelihoods](https://github.com/jvlab/rs-software/blob/main/src/rs_py/choices/choice_likelihoods.py): `src/rs_py/choices/choice_likelihoods.py`
- [Model fitting runner](https://github.com/jvlab/rs-software/blob/main/src/rs_py/scripts/model_fitting.py): `src/rs_py/scripts/model_fitting.py`
- [Geometric model fitting](https://github.com/jvlab/rs-software/blob/main/src/rs_py/model/fit_geometric_models.py): `src/rs_py/model/fit_geometric_models.py`
- [Curved-model runner](https://github.com/jvlab/rs-software/blob/main/src/rs_py/scripts/run_curved_space_model_fitting.py): `src/rs_py/scripts/run_curved_space_model_fitting.py`
- [Curved-model comparison](https://github.com/jvlab/rs-software/blob/main/src/rs_py/model/compare_curved_space_models.py): `src/rs_py/model/compare_curved_space_models.py`

### Geometry and analysis

- [Euclidean geometry](https://github.com/jvlab/rs-software/blob/main/src/rs_py/geometry/euclidean.py): `src/rs_py/geometry/euclidean.py`
- [Hyperbolic geometry](https://github.com/jvlab/rs-software/blob/main/src/rs_py/geometry/hyperbolic.py): `src/rs_py/geometry/hyperbolic.py`
- [Spherical geometry](https://github.com/jvlab/rs-software/blob/main/src/rs_py/geometry/spherical.py): `src/rs_py/geometry/spherical.py`

### Shared utilities

- [Coordinate anchoring](https://github.com/jvlab/rs-software/blob/main/src/rs_py/utils/anchor_coordinates.py): `src/rs_py/utils/anchor_coordinates.py`
- [MDS initialization](https://github.com/jvlab/rs-software/blob/main/src/rs_py/utils/mds_embedding.py): `src/rs_py/utils/mds_embedding.py`
- [Optimization](https://github.com/jvlab/rs-software/blob/main/src/rs_py/utils/minimize.py): `src/rs_py/utils/minimize.py`
- [Judgment utilities](https://github.com/jvlab/rs-software/blob/main/src/rs_py/utils/util.py): `src/rs_py/utils/util.py`
- [Output helpers](https://github.com/jvlab/rs-software/blob/main/src/rs_py/utils/helpers.py): `src/rs_py/utils/helpers.py`
- [Run configuration](https://github.com/jvlab/rs-software/blob/main/src/rs_py/utils/config.py): `src/rs_py/utils/config.py`
- [Logging](https://github.com/jvlab/rs-software/blob/main/src/rs_py/utils/logging.py): `src/rs_py/utils/logging.py`

### Other components

- **Researcher**
- [MATLAB toolkit](https://github.com/jvlab/rs-software/tree/main/src): `src`

## Connections

- Researcher → Combined choice writer: prepares choices (evidence: `README.md`)
- Researcher → Detailed choice writer: prepares choices (evidence: `README.md`)
- Researcher → Model fitting runner: analyzes judgments (evidence: `README.md`)
- Combined choice writer → Run configuration: reads settings (evidence: `src/rs_py/scripts/write_choice_file.py`)
- Combined choice writer → Combined choice files: writes choice file (evidence: `src/rs_py/scripts/write_choice_file.py`)
- Detailed choice writer → Run configuration: reads settings (evidence: `src/rs_py/scripts/write_choice_file_detailed.py`)
- Detailed choice writer → Detailed response parsing: writes choice file (evidence: `src/rs_py/scripts/write_choice_file_detailed.py`)
- Detailed response parsing → Output helpers: uses helpers (evidence: `src/rs_py/choices/choice_file_detailed.py`)
- Model fitting runner → Geometric model fitting: runs fitting (evidence: `src/rs_py/scripts/model_fitting.py`)
- Model fitting runner → Choice likelihoods: evaluates choices (evidence: `src/rs_py/scripts/model_fitting.py`)
- Model fitting runner → Run configuration: loads settings (evidence: `src/rs_py/scripts/model_fitting.py`)
- Model fitting runner → Output helpers: writes results (evidence: `src/rs_py/scripts/model_fitting.py`)
- Geometric model fitting → Hyperbolic geometry: uses geometry (evidence: `src/rs_py/model/fit_geometric_models.py`)
- Geometric model fitting → Spherical geometry: uses geometry (evidence: `src/rs_py/model/fit_geometric_models.py`)
- Geometric model fitting → Coordinate anchoring: anchors coordinates (evidence: `src/rs_py/model/fit_geometric_models.py`)
- Geometric model fitting → MDS initialization: seeds optimization (evidence: `src/rs_py/model/fit_geometric_models.py`)
- Geometric model fitting → Optimization: uses optimizer (evidence: `src/rs_py/model/fit_geometric_models.py`)
- Geometric model fitting → Judgment utilities: formats judgments (evidence: `src/rs_py/model/fit_geometric_models.py`)
- Geometric model fitting → Choice likelihoods: scores fit (evidence: `src/rs_py/model/fit_geometric_models.py`)
- Curved-model runner → Curved-model comparison: runs comparison (evidence: `src/rs_py/scripts/run_curved_space_model_fitting.py`)
- Curved-model comparison → Geometric model fitting: fits alternatives (evidence: `src/rs_py/model/compare_curved_space_models.py`)
- Choice likelihoods → Coordinate anchoring: uses coordinates (evidence: `src/rs_py/choices/choice_likelihoods.py`)
- Choice likelihoods → Judgment utilities: uses utilities (evidence: `src/rs_py/choices/choice_likelihoods.py`)
- MDS initialization → Logging: logs progress (evidence: `src/rs_py/utils/mds_embedding.py`)
- Geometric model fitting → Logging: logs progress (evidence: `src/rs_py/model/fit_geometric_models.py`)
