Commit 024ff07b authored by Momme Butenschoen's avatar Momme Butenschoen
parents
*.pyc
*~
*.swp
__pycache__
PCA.egg-info/
_build
This diff is collapsed.
# Include the license file
include LICENSE.txt
include README.rst
# Include the data files
# recursive-include data *
# If using Python 2.6 or less, then have to include package data, even though
# it's already declared in setup.py
from __future__ import print_function
from scipy.linalg import svd
from numpy.ma import getmaskarray,masked_where,compress_rows,dot,diag
from numpy.ma import zeros as mzeros
from numpy.ma import array as marray
from numpy import any,nonzero,array,rank,sqrt,eye,ones,arange
from Map2D import Map2D
def standard(d):
"""
Standardise 2D data along the last dimension.
Args:
d(numpy.array float): input data
"""
d=d.transpose()
d=(d-d.mean(0))/d.std(0)
return d.transpose()
def samplemean(d):
"""
Take out the mean of 2D data along the last dimension.
Args:
d(numpy.array float): input data
"""
d=d.transpose()
d=d-d.mean(0)
return d.transpose()
def Varimax(x,norm=None,tol=1.e-10,nit=1000):
"""
Computex varimax rotation of x.
Args:
x (numpy.array float): input data
norm (optional): normalising function to use on x
tol (float): error tolerance for iteration exit
nit (integer): maximum number of iterations
Returns:
numpy.arry float): rotation matrix xrot=dot(x,r)
"""
if norm!=None:
x=norm(x)
p,nc=x.shape
print("\tcomputing varimax rotation for ",nc," components...")
TT=eye(nc)
d=-1
for i in arange(nit):
z=dot(x,TT)
B=dot(x.transpose(),
( z**3-dot( z,diag(dot(ones([p]),z**2).squeeze()) )/p ))
u,s,v=svd(B)
TT=dot(u,v.transpose())
d2=d
d=diag(s).sum()
if d2<d<d2*(1.+tol): break
print("\t\t...used ",i,"iterations to tolerance level ",d/d2-1)
return TT
class pca:
"""
Class for performing princial component analysis.
Attributes:
data: input data normalised
EV: eigen-vectors of data covariance (loadings of the PCs),
Ut of svd decomposition
scores: scores of the PCs = EV*data, diag(s)*V of
svd-decomposition
Sing: singular values of data SVD decomposition
Var: variance in the respective component
VarFrac: fractional variance in the respective component
squaredDeviations: score squared relative to total variance,
contribution to variance per sample and component
m2d: Map2D map to shape and reshape arrays from input data
shape to 2D structure.
"""
def __init__(self,data,no=-1,sampledims=-1,norm=standard,reductDim=0,
rotate=0):
"""
Computes no-dimensional PCA from input data.
Input data will be reshaped in 2D with a dimension containing
the PCA variable space and the PCA sample space.
Args:
data (numpy.array float): input data
sampleDims(integer or list of integers, optional): dimensions of input data that are collapsed to the sample dimension. Defaults to -1.
norm: normalising function. Defaults to standard.
reductDim (integer, optional): dimension along which is compressed using masked values, has to be homogenesous in the other dimension. 0 = variable dim, 1 = sampling dim. Defaults to 0.
"""
# Set up mapping:
self.m2d=Map2D(data,sampledims,axis=1)
#reshaping to 2D:
data=self.m2d(data)
# mapping in 2D shape:
if norm !=None: data=norm(data)
self.data=self._remap(data)
expand=False
if any(getmaskarray(data)):
print("\tcompressing input data...")
print("\t\tFull size of data:",data.shape)
#filter out variables that contain masked elements:
# (e.g. land points):
print("\t\t\tmasking data...")
if reductDim==1:
expand=True
data=data.transpose()
Mask=getmaskarray(data).max(1)
if reductDim==0:
expand=True # set flag to expand results
idx1D=nonzero(-Mask)
print("\t\t\tcompressing...")
#data=compress_rows(data) # DAMN SLOW,substituted!!!
clist=[]
for n,d in enumerate(data):
Mask[n] or clist.append(d)
data=marray(clist)
if reductDim==1: data=data.transpose()
print("\t\tCompressed size of data:",data.shape)
#compute svd:
print("\tcomputing SVD...")
u,s,v=svd(data,full_matrices=False)
#scores: (=eigenvector*data)
if no==-1: no=u.shape[1]
sv=dot(diag(s[:no]),v[:no,:])
if rotate>0:
r=Varimax(u[:,:rotate])
if expand and reductDim==1:
print("\texpanding scores...")
scores=mzeros([no,self.m2d.columns])
for n,v in enumerate(scores):
v[idx1D]=sv[n,:]
scores[n,:]=masked_where(Mask,v.data)
else:
scores=sv
self.scores=self._remapScores(scores)
if expand and reductDim==0:
print("\texpanding loadings...")
EV=mzeros([no,self.m2d.rows])
u=u[:,:no].transpose()
for n,pc in enumerate(EV):
pc[idx1D]=u[n,:]
EV[n,:]=masked_where(Mask,pc.data)
else:
EV=u[:,:no].transpose()
self.EV=self._remapEV(EV)
self.Sing=s[:no]
self.Var=s[:no]**2 #variances of components (eigenvalues)
self.VarFrac=s[:no]**2/(s**2).sum() #fractions of total variance
#self.rot*X rotates X on varimax dirs:
if rotate: self.rot=r.transpose()
def __call__(self,n):
"""
Computes scores for nth prinipal component.
Args:
n (integer): number of component to compute.
Returns:
tuple of float numpy.arrays: eigenvector and score of nth component.
"""
return self.EV[n,:],self.scores[n,:]
def squaredDeviations(self):
"""score squared relative to total variance (contribution to
variance per sample and component)"""
sD=self.scores()**2/self.V.sum()
return sD.reshape([self.EV.shape[0]]+list(self.sampleShape))
def _map(self,data):
"""
Maps data into 2D shape.
Args:
data (numpy.array float): input data.
Returns:
numpy.array float: data mapped onto 2D.shape.
"""
data=self.m2d(data)
print("Mapped data to 2D shape:",data.shape)
return data
def _remap(self,data):
"""
Remaps data into full shape.
Args:
data (numpy.array float): 2D data.
Returns:
numpy.array float: data mapped onto full shape.
"""
data=self.m2d.inv(data)
print("Remapped data to full shape:",data.shape)
return data
def _remapEV(self,EV):
"""
Remaps Eigenvalues into full shape.
Args:
EV (numpy.array float): 2D data.
Returns:
numpy.array float: Eigenvalues mapped onto full shape.
"""
EV=self.m2d.Xinv(EV)
return EV
def _remapScores(self,scores):
"""
Remaps scores into full shape.
Args:
scores (numpy.array float): 2D data.
Returns:
numpy.array float: scores mapped onto full shape.
"""
scores=self.m2d.Yinv(scores)
return scores
"""
PCA package initialisation.
"""
from .PCA import *
==========
PCA README
==========
Python tools for computing seawater density and potential energy anomaly.
Installation:
-------------
After downloading the source from the repository install via pip, descend
into the top-level of the source tree
and launch::
pip3 install .
or to install in developers mode::
pip3 install -e .
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
PYTHON = python3
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " applehelp to make an Apple Help Book"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
@echo " coverage to run coverage check of the documentation (if enabled)"
.PHONY: clean
clean:
rm -rf $(BUILDDIR)/*
.PHONY: html
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
.PHONY: dirhtml
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
.PHONY: singlehtml
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
.PHONY: pickle
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
.PHONY: json
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
.PHONY: htmlhelp
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
.PHONY: qthelp
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/PCA.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/PCA.qhc"
.PHONY: applehelp
applehelp:
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
@echo
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
@echo "N.B. You won't be able to view it unless you put it in" \
"~/Library/Documentation/Help or install it in your application" \
"bundle."
.PHONY: devhelp
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/PCA"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/PCA"
@echo "# devhelp"
.PHONY: epub
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
.PHONY: latex
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
.PHONY: latexpdf
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
.PHONY: latexpdfja
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
.PHONY: text
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
.PHONY: man
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
.PHONY: texinfo
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
.PHONY: info
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
.PHONY: gettext
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
.PHONY: changes
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
.PHONY: linkcheck
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
.PHONY: doctest
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
.PHONY: coverage
coverage:
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
@echo "Testing of coverage in the sources finished, look at the " \
"results in $(BUILDDIR)/coverage/python.txt."
.PHONY: xml
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
.PHONY: pseudoxml
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
PCA package
===========
Submodules
----------
PCA.PCA module
--------------
.. automodule:: PCA.PCA
:members:
:undoc-members:
:special-members:
:show-inheritance:
Module contents
---------------
.. automodule:: PCA
:members:
:undoc-members:
:show-inheritance:
This diff is collapsed.
.. PCA documentation master file, created by
sphinx-quickstart on Sat Nov 5 03:44:48 2016.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to PCA's documentation!
===============================
Contents:
.. toctree::
:maxdepth: 2
readme
PCA
modules
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
@ECHO OFF
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
set I18NSPHINXOPTS=%SPHINXOPTS% .
if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)
if "%1" == "" goto help
if "%1" == "help" (
:help
echo.Please use `make ^<target^>` where ^<target^> is one of
echo. html to make standalone HTML files
echo. dirhtml to make HTML files named index.html in directories
echo. singlehtml to make a single large HTML file
echo. pickle to make pickle files
echo. json to make JSON files
echo. htmlhelp to make HTML files and a HTML help project
echo. qthelp to make HTML files and a qthelp project
echo. devhelp to make HTML files and a Devhelp project
echo. epub to make an epub
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
echo. text to make text files
echo. man to make manual pages
echo. texinfo to make Texinfo files
echo. gettext to make PO message catalogs
echo. changes to make an overview over all changed/added/deprecated items
echo. xml to make Docutils-native XML files
echo. pseudoxml to make pseudoxml-XML files for display purposes
echo. linkcheck to check all external links for integrity
echo. doctest to run all doctests embedded in the documentation if enabled
echo. coverage to run coverage check of the documentation if enabled
goto end
)
if "%1" == "clean" (
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
del /q /s %BUILDDIR%\*
goto end
)
REM Check if sphinx-build is available and fallback to Python version if any
%SPHINXBUILD% 1>NUL 2>NUL
if errorlevel 9009 goto sphinx_python
goto sphinx_ok
:sphinx_python
set SPHINXBUILD=python -m sphinx.__init__
%SPHINXBUILD% 2> nul
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
:sphinx_ok
if "%1" == "html" (
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
goto end
)
if "%1" == "dirhtml" (
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
goto end
)
if "%1" == "singlehtml" (
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
goto end
)
if "%1" == "pickle" (
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the pickle files.
goto end
)
if "%1" == "json" (
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the JSON files.
goto end
)
if "%1" == "htmlhelp" (
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
goto end
)
if "%1" == "qthelp" (
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\PCA.qhcp
echo.To view the help file:
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\PCA.ghc
goto end
)
if "%1" == "devhelp" (
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished.
goto end
)
if "%1" == "epub" (
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The epub file is in %BUILDDIR%/epub.
goto end
)
if "%1" == "latex" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
if errorlevel 1 exit /b 1
echo.
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdf" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf
cd %~dp0
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdfja" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf-ja
cd %~dp0
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "text" (
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The text files are in %BUILDDIR%/text.
goto end
)
if "%1" == "man" (
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The manual pages are in %BUILDDIR%/man.
goto end
)
if "%1" == "texinfo" (
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
goto end
)
if "%1" == "gettext" (
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
goto end
)
if "%1" == "changes" (
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
if errorlevel 1 exit /b 1
echo.
echo.The overview file is in %BUILDDIR%/changes.
goto end
)
if "%1" == "linkcheck" (
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
if errorlevel 1 exit /b 1
echo.
echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
goto end
)