pyfug — High-Definition Time Series Analysis Graphics
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.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyfug-2.1.0.tar.gz | 58.7 kB | With provenance | Details for pyfug-2.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyfug-2.1.0-py3-none-any.whl | Python 3 | none | any | Details for pyfug-2.1.0-py3-none-any.whl |
Total release size: 113.9 kB
Release files / pyfug-2.1.0.tar.gz
| Download URL | pyfug-2.1.0.tar.gz |
|---|---|
| Size | 58.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cc8f2c7c36207b95b346974e87d02010a62119cf31940c25d61f3a15b91c32cd
|
|
BLAKE2b-256 checksum How to use checksums |
91784ecbb2d962d9d08c629831535298e5127b6842e0660558202dfc57db64b2
|
| 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 18, 2026.
Transparency logRelease files / pyfug-2.1.0-py3-none-any.whl
| Download URL | pyfug-2.1.0-py3-none-any.whl |
|---|---|
| Size | 55.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5fe38f6b911dc3715712f1d235bd9c809e3c56e8e4a2801ba4a92593d008dff5
|
|
BLAKE2b-256 checksum How to use checksums |
ef28feed3ccddfdbfefabb8d0b5aafc233e396021a174de399e54130c023f82c
|
| 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 18, 2026.
Transparency logSecurity for pyfug 2.1.0
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.
Attestation for pyfug-2.1.0.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 18, 2026.
Transparency logA 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.