Skip to main content

pyfug — High-Definition Time Series Analysis Graphics

Version Python License

pyfug es la migración a Python del programa FUG 1.12 (C/gnuplot), diseñado por Arthur B. Treadway y David E. Guerrero. Produce gráficos de series temporales de alta definición con las proporciones precisas del diseño Jenkins-Treadway, ahora usando matplotlib como motor gráfico.

¿Qué aporta sobre el FUG original?

Original (C + gnuplot) pyfug (Python + matplotlib)
Solo entrada .inp .inp, CSV, Excel, pandas, numpy
Solo salida EPS PDF vectorial, SVG, PNG, interactivo (Jupyter)
Solo CLI CLI + API Python + Jupyter notebooks
Gnuplot externo matplotlib integrado (sin dependencias externas)
Compilación C pip install
Sin integración Conectable con statsmodels, scipy, pandas

Instalación

cd pyfug
pip install -e .

# Opcional: soporte Jupyter
pip install -e ".[jupyter]"

Uso rápido

Desde línea de comandos

# Gráfico combinado (serie + ACF/PACF) — igual que FUG original
pyfug PU.inp one -c

# Set de identificación con hasta 2 diferencias regulares y 1 estacional
pyfug PU.inp set 2 1 -c

# Solo ACF/PACF con 24 lags
pyfug PU.inp one -b -l 24

# Histograma + mean-deviation chart
pyfug PU.inp one -d -e

Desde Python

from pyfug import read_inp, diffgraph

# Leer datos
ser = read_inp("PU.inp")

# Gráfico combinado con log y 1 diferencia regular
result = diffgraph(ser,
    boxlam=0.0,    # log
    nrdiff=1,      # 1 diferencia regular
    case_c=True,   # combinado
    return_figs=True)

fig = result['figures'][0]
fig.savefig("output.pdf")

Desde pandas/CSV

import pandas as pd
from pyfug import read_pandas, diffgraph

# Desde DataFrame
df = pd.read_csv("mis_datos.csv")
ser = read_pandas(df["precios"], name="IPC", freq=12, begyear=2020)

# Generar gráficos
result = diffgraph(ser, boxlam=0.0, nrdiff=1, case_c=True)

En Jupyter

from pyfug import read_inp
from pyfug.jupyter import display_diffgraph

ser = read_inp("PU.inp")

# Muestra todos los gráficos inline
transformed = display_diffgraph(ser,
    boxlam=0.0, nrdiff=1, nadiff=0,
    case_c=True, case_d=True, case_e=True)

Con modelos de estimación (statsmodels)

from statsmodels.tsa.arima.model import ARIMA
from pyfug.jupyter import from_statsmodels_result, diagnostic_plots

# Ajustar modelo
model = ARIMA(ser.data, order=(1, 1, 1))
result = model.fit()

# Extraer residuos como Tseries
resid_ser = from_statsmodels_result(result, name="Residuos ARIMA(1,1,1)")

# Gráficos de diagnóstico completos
diagnostic_plots(resid_ser, model_name="ARIMA111")

Tipos de gráficos

Flag Gráfico Descripción
-a Serie temporal Línea con etiquetas de año precisas
-b ACF/PACF Correlograma con bandas ±2/√n y Q de Ljung-Box
-c Combinado Serie + ACF/PACF en layout multi-panel
-d Histograma Histograma estandarizado + curva normal
-e Mean-Deviation Medias vs desviaciones típicas estandarizadas

Estructura del proyecto

pyfug/
├── pyfug/
│   ├── __init__.py          # API pública
│   ├── core.py               # Tseries dataclass
│   ├── io.py                 # Lectura .inp, CSV, Excel, pandas
│   ├── transform.py          # Box-Cox, diferencias
│   ├── statistics.py         # ACF, PACF, Ljung-Box, estadísticos
│   ├── graphics/
│   │   ├── __init__.py
│   │   ├── base.py           # Constantes y tema Jenkins-Treadway
│   │   ├── series.py         # Gráfico de serie
│   │   ├── acf_pacf.py       # Correlograma ACF/PACF
│   │   ├── combined.py       # Serie + ACF/PACF combinado
│   │   ├── histogram.py      # Histograma + normal
│   │   ├── mean_deviation.py # Mean-Deviation chart
│   │   └── engine.py         # Motor principal (diffgraph)
│   ├── latex.py              # Salida LaTeX
│   ├── cli.py                # Interfaz línea de comandos
│   └── jupyter.py            # Integración Jupyter
├── tests/
├── examples/
├── pyproject.toml
└── README.md

Diseño Jenkins-Treadway

El valor distintivo de FUG/pyfug está en las proporciones precisas de los gráficos:

  • ACF/PACF: Sin ticks en el eje X — usa líneas verticales y etiquetas manuales en los lags; bandas de confianza ±2/√n en rojo; estadístico Ljung-Box como etiqueta del eje X.
  • Serie temporal: Etiquetas de año en lugar de ticks; borde solo en izquierda e inferior; grid horizontal; grosor de línea calibrado.
  • Layout combinado: Serie grande a la izquierda, ACF y PACF a la derecha en dos paneles con proporciones exactas según número de lags y frecuencia de los datos.
  • Histograma: Estructura cuadrada con curva normal superpuesta; asimetría, curtosis y Jarque-Bera como etiqueta del eje X.

Licencia

GNU General Public License v2.0 — mismo régimen que el FUG original.

Autores

  • Arthur B. Treadway — diseño original Jenkins-Treadway, FUG 1.x (C)
  • David E. Guerrero — FUG 1.x (C), migración a Python 2.0

Metadata

Release files for pyfug 2.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyfug 2.0.3
File Size Uploaded Provenance Actions
pyfug-2.0.3.tar.gz 54.4 kB With provenance Details for pyfug-2.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyfug 2.0.3
File Interpreter ABI Platform Actions
pyfug-2.0.3-py3-none-any.whl Python 3 none any Details for pyfug-2.0.3-py3-none-any.whl

Total release size: 106.2 kB

Release files / pyfug-2.0.3.tar.gz

Download URL pyfug-2.0.3.tar.gz
Size 54.4 kB
Tags Source
SHA-256 checksum
How to use checksums
141f121656ec0d709aaf78cc00c6abc82f489b0d145d30f73ceecbdc734abedd
BLAKE2b-256 checksum
How to use checksums
c78ff2e22f4473f9e16f3ad727285f7136a30a350d6c0c4b566ae6e04ff3144d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / pyfug-2.0.3-py3-none-any.whl

Download URL pyfug-2.0.3-py3-none-any.whl
Size 51.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a033eea64d060c24135438825951ec2b20beeadfbb0dffdcaf6d48a2df49031d
BLAKE2b-256 checksum
How to use checksums
86bd310ce0afcc7637f7c5f9d8f99a95f76233d065a25b845aa9759b26cd465d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Security for pyfug 2.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pyfug-2.0.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page