Coordinate transforms, Laurent series fitting, and analytic continuation pipeline utilities for complex analysis
Project description
analytic-continuation
A Python package for coordinate transforms, Laurent series fitting, and analytic continuation pipeline utilities for complex analysis visualizations.
Overview
This package provides tools for working with complex analysis, particularly focused on:
- Coordinate Transforms: Transform between screen space and logical (complex plane) coordinates with the
SpaceAdapterclass - Laurent Series Fitting: Fit Laurent maps to Jordan curves, mapping the unit circle to approximate curve boundaries
- Meromorphic Function Construction: Build meromorphic functions from zeros and poles with proper mathematical expressions
- Analytic Continuation Pipeline: Utilities for holomorphic checking, inversion, and composition operations
- Intrinsic Curve Analysis: Analyze curves using Cesaro and Whewell representations
- Progress Tracking: Pipeline stage tracking and logging infrastructure
Installation
pip install analytic-continuation
For development:
pip install analytic-continuation[dev]
Quick Start
SpaceAdapter for Coordinate Transforms
from analytic_continuation import SpaceAdapter, TransformParams
# Create an adapter for a 800x600 screen viewing [-2, 2] x [-1.5, 1.5]
params = TransformParams.from_view_bounds(
screen_width=800,
screen_height=600,
logical_x_range=(-2, 2),
logical_y_range=(-1.5, 1.5),
)
adapter = SpaceAdapter(params)
# Convert screen coordinates to complex numbers
z = adapter.screen_to_complex(400, 300) # Returns 0+0j (center)
# Convert complex numbers to screen coordinates
screen_x, screen_y = adapter.complex_to_screen(1 + 1j)
Laurent Series Fitting
from analytic_continuation import (
LaurentFitConfig,
fit_laurent_map,
SplineExport,
)
# Load curve data from a SplineExport
with open("curve.json") as f:
export = SplineExport.from_json(f.read())
# Fit a Laurent map
config = LaurentFitConfig(N_min=6, N_max=32)
result = fit_laurent_map(export, config)
if result.ok:
# Evaluate the map at points on the unit circle
import numpy as np
thetas = np.linspace(0, 2 * np.pi, 100)
zetas = np.exp(1j * thetas)
curve_points = result.laurent_map.eval_array(zetas)
Meromorphic Function Builder
from analytic_continuation import MeromorphicBuilder, Singularity
# Build a meromorphic function with zeros and poles
builder = MeromorphicBuilder()
builder.add_zero(1, 0) # Zero at z = 1
builder.add_zero(-1, 0) # Zero at z = -1
builder.add_pole(0, 1) # Pole at z = i
builder.add_pole(0, -1) # Pole at z = -i
expr = builder.build_expression()
# Returns: "(z-1)*(z+1)/((z-i)*(z+i))"
Analytic Continuation Pipeline
from analytic_continuation import (
check_f_holomorphic_on_annulus,
invert_z,
compute_composition,
HolomorphicCheckConfig,
InvertConfig,
)
# Check if a function is holomorphic on an annulus
config = HolomorphicCheckConfig(rho_in=0.5, rho_out=2.0)
result = check_f_holomorphic_on_annulus(laurent_map, config)
# Compute the inverse map
invert_cfg = InvertConfig(max_iter=100, tol=1e-10)
inv_result = invert_z(laurent_map, target_z, invert_cfg)
Core Components
Types Module
Point: 2D point with optional index, convertible to/from complex numbersSpline: Sequence of points forming a spline or polylineSplineExport: Full spline export structure matching frontend formatLaurentMap: Laurent series coefficients for serializationComplex: Serializable complex number representation
SpaceAdapter Module
TransformParams: Parameters for screen-to-logical coordinate transformsSpaceAdapter: Main class for coordinate transformations
Laurent Module
LaurentFitConfig: Configuration for Laurent map fittingLaurentMapResult: Result of Laurent map evaluation with coefficientsFitResult: Complete fitting result including quality metricsfit_laurent_map(): Main entry point for Stage 3 fitting
Meromorphic Module
Singularity: Zero or pole with location and multiplicityMeromorphicBuilder: Builder class for constructing meromorphic functionsbuild_meromorphic_expression(): Build sympy-compatible expressions
Continuation Module
Pole: Pole location with residue informationHolomorphicCheckConfig/HolomorphicCheckResult: Holomorphic checkingInvertConfig/InvertResult: Inversion configuration and resultsCompositionResult: Composition computation resultscheck_f_holomorphic_on_annulus(): Check holomorphicity on annulusinvert_z(): Compute inverse mappingcompute_composition(): Compute function compositionscompute_continuation_grid(): Compute continuation on a grid
Intrinsic Curve Module
CesaroRepresentation: Cesaro (curvature vs arc length) formWhewellRepresentation: Whewell (tangent angle vs arc length) formIntrinsicCurveAnalysis: Complete intrinsic curve analysisanalyze_bijection(): Analyze a bijection between curvesprecheck_contour(): Quick pre-check for raw contours (Stage 1 gate)
Logging and Progress
PipelineLogger: Structured logging for pipeline stagesProgressTracker: Track progress through pipeline stagesTaskStatus/TaskProgress: Task status trackingformat_cli_progress(): Format progress for CLI display
Pipeline Stages
The package implements utilities for a multi-stage analytic continuation pipeline:
- Stage 1: Contour pre-check and validation
- Stage 2: Intrinsic curve analysis (Cesaro/Whewell forms)
- Stage 3: Laurent map fitting (main fitting stage)
- Stage 4: Holomorphic checking on annulus
- Stage 5: Inversion computation
- Stage 6: Composition and continuation grid computation
Development
Running Tests
pytest tests/
Building Documentation
cd docs
make html
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file analytic_continuation-0.1.0.tar.gz.
File metadata
- Download URL: analytic_continuation-0.1.0.tar.gz
- Upload date:
- Size: 70.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1083f29354cad30b3cf8262a1d3e7e0bca531b7bd77c8c423c29a66225a94516
|
|
| MD5 |
b7c3e0c9c77ee2af6a283f63ac8f604b
|
|
| BLAKE2b-256 |
8b7203f81213b9094652e324e9a55e289930429a1524cdab8209932356d3f67b
|
File details
Details for the file analytic_continuation-0.1.0-py3-none-any.whl.
File metadata
- Download URL: analytic_continuation-0.1.0-py3-none-any.whl
- Upload date:
- Size: 50.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31be56923848e5079398be24d3837b46e96dc4b2d5e95b2b2d050e30e47fb9fa
|
|
| MD5 |
d801dbf927ec37cce7bebc6b6d3419b8
|
|
| BLAKE2b-256 |
ceaa44dc920aa40a2f0ae5463f0fa6cec54110759ac32cc854ff4cbc8c460732
|