Skip to content

Commit

Permalink
Merge pull request #107 from pcubillos/pnames
Browse files Browse the repository at this point in the history
Pnames
  • Loading branch information
pcubillos authored Feb 1, 2019
2 parents 2b03a67 + 60c76d0 commit c49eabf
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion MCcubed/VERSION.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# MC3 Version:
MC3_VER = 2 # Major version
MC3_MIN = 3 # Minor version
MC3_REV = 23 # Revision
MC3_REV = 24 # Revision
14 changes: 7 additions & 7 deletions MCcubed/mc/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def mcmc(data=None, uncert=None, func=None, indparams=None,
fgamma=None, fepsilon=None, hsize=None, kickoff=None,
plots=None, ioff=None, showbp=None,
savefile=None, savemodel=None, resume=None,
rms=None, log=None, pnames=None, figpnames=None,
rms=None, log=None, pnames=None, texnames=None,
full_output=None, chireturn=None,
cfile=None, parname=None):
"""
Expand Down Expand Up @@ -147,10 +147,10 @@ def mcmc(data=None, uncert=None, func=None, indparams=None,
Configuration file name.
pnames: 1D string ndarray
List of parameter names (including fixed and shared parameters)
to display on output screen and figures. See also figpnames.
to display on output screen and figures. See also texnames.
Screen output trims up to the 11th character.
If not defined, default to figpnames.
figpnames: 1D string iterable
If not defined, default to texnames.
texnames: 1D string iterable
Parameter names for figures, which may use latex syntax.
If not defined, default to pnames.
parname: 1D string ndarray
Expand Down Expand Up @@ -418,9 +418,9 @@ def parse():
group.add_argument("--pnames", dest="pnames", action="store",
type=mu.parray, default=None,
help="List of parameter names for screen output (and "
"figures if figpnames is not defined). If pnames "
"is not defined, default to figpnames.")
group.add_argument("--figpnames", dest="figpnames", action="store",
"figures if texnames is not defined). If pnames "
"is not defined, default to texnames.")
group.add_argument("--texnames", dest="texnames", action="store",
type=mu.parray, default=None,
help="List of parameter names for figures (may use "
"latex syntax). [default: None]")
Expand Down
30 changes: 15 additions & 15 deletions MCcubed/mc/mcmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def mcmc(data, uncert=None, func=None, indparams=[],
fgamma=1.0, fepsilon=0.0, hsize=1, kickoff='normal',
plots=False, ioff=False, showbp=True,
savefile=None, savemodel=None, resume=False,
rms=False, log=None, pnames=None, figpnames=None,
rms=False, log=None, pnames=None, texnames=None,
full_output=False, chireturn=False,
parname=None):
"""
Expand Down Expand Up @@ -144,10 +144,10 @@ def mcmc(data, uncert=None, func=None, indparams=[],
Filename or File object to write log.
pnames: 1D string iterable
List of parameter names (including fixed and shared parameters)
to display on output screen and figures. See also figpnames.
to display on output screen and figures. See also texnames.
Screen output trims up to the 11th character.
If not defined, default to figpnames.
figpnames: 1D string iterable
If not defined, default to texnames.
texnames: 1D string iterable
Parameter names for figures, which may use latex syntax.
If not defined, default to pnames.
full_output: Bool
Expand Down Expand Up @@ -261,14 +261,14 @@ def mcmc(data, uncert=None, func=None, indparams=[],
uncert = np.ones(ndata)

# Setup array of parameter names:
if pnames is None and figpnames is not None:
pnames = figpnames
elif pnames is not None and figpnames is None:
figpnames = pnames
elif pnames is None and figpnames is None:
pnames = figpnames = mu.default_parnames(nparams)
pnames = np.asarray(pnames)
figpnames = np.asarray(figpnames)
if pnames is None and texnames is not None:
pnames = texnames
elif pnames is not None and texnames is None:
texnames = pnames
elif pnames is None and texnames is None:
pnames = texnames = mu.default_parnames(nparams)
pnames = np.asarray(pnames)
texnames = np.asarray(texnames)

# Set uncert as shared-memory object:
sm_uncert = mpr.Array(ctypes.c_double, uncert)
Expand Down Expand Up @@ -706,13 +706,13 @@ def mcmc(data, uncert=None, func=None, indparams=[],
else:
bestfreepars = None
# Trace plot:
mp.trace(Z, Zchain=Zchain, burnin=Zburn, pnames=figpnames[ifree],
mp.trace(Z, Zchain=Zchain, burnin=Zburn, pnames=texnames[ifree],
savefile=fname+"_trace.png")
# Pairwise posteriors:
mp.pairwise(posterior, pnames=figpnames[ifree], bestp=bestfreepars,
mp.pairwise(posterior, pnames=texnames[ifree], bestp=bestfreepars,
savefile=fname+"_pairwise.png")
# Histograms:
mp.histogram(posterior, pnames=figpnames[ifree], bestp=bestfreepars,
mp.histogram(posterior, pnames=texnames[ifree], bestp=bestfreepars,
savefile=fname+"_posterior.png",
percentile=0.683, pdf=pdf, xpdf=xpdf)
# RMS vs bin size:
Expand Down
10 changes: 5 additions & 5 deletions docs/mctutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -281,16 +281,16 @@ The ``pnames`` argument (optional) define the names of the model
parametes to be shown in the scren output and figure labels. In
figures, the names can use LaTeX syntax. The screen output will
display up to 11 characters. Thus, the user can define the
``figpnames`` argument (optional), display the appropriate syntax for
``texnames`` argument (optional), display the appropriate syntax for
screen output and figures, for example:

.. code-block:: python
pnames = ["log(alpha)", "beta", "Teff"]
figpnames = [r"$\log(\alpha)$", r"$\beta$", r"$T_{\rm eff}$"]
pnames = ["log(alpha)", "beta", "Teff"]
texnames = [r"$\log(\alpha)$", r"$\beta$", r"$T_{\rm eff}$"]
If ``figpnames`` is ``None``, it defaults to ``pnames``. If ``pnames``
is ``None``, it defaults to ``figpnames``. If both arguments are
If ``texnames`` is ``None``, it defaults to ``pnames``. If ``pnames``
is ``None``, it defaults to ``texnames``. If both arguments are
``None``, they default to a generic ``[Param 1, Param 2, ...]`` list.

.. _walk:
Expand Down

0 comments on commit c49eabf

Please sign in to comment.