diff --git a/README.rst b/README.rst index 8db12bf..32f7f8d 100644 --- a/README.rst +++ b/README.rst @@ -31,9 +31,9 @@ from Markov Chain Monte Carlo (MCMC). * **Convergence diagnostics** - including correlation length and diagonalized Gelman-Rubin statistics * **LaTeX tables** for marginalized 1D constraints -See the `Plot Gallery and tutorial `_ +See the `Plot Gallery and tutorial `_ (`run online `_) -and `GetDist Documentation `_. +and `GetDist Documentation `_. Getting Started @@ -45,10 +45,6 @@ Install getdist using pip:: or from source files using:: - $ python setup.py install - -or:: - $ pip install -e /path/to/source/ You can test if things are working using the unit test by running:: @@ -59,7 +55,7 @@ Check the dependencies listed in the next section are installed. You can then us use the GetDist GUI (*getdist-gui* command). Once installed, the best way to get up to speed is probably to read through -the `Plot Gallery and tutorial `_. +the `Plot Gallery and tutorial `_. Dependencies ============= @@ -84,8 +80,8 @@ Samples file format =================== GetDist can be used in scripts and interactively with standard numpy arrays -(as in the `examples `_). -Scripts and the `GetDist GUI `_ can also read parameter sample/chain files in plain text format +(as in the `examples `_). +Scripts and the `GetDist GUI `_ can also read parameter sample/chain files in plain text format (or in the format output by the `Cobaya `__ sampling program). In general plain text files of the form:: @@ -194,7 +190,7 @@ GetDist GUI Run *getdist-gui* to run the graphical user interface. This requires PySide, but will run on Windows, Linux and Mac. It allows you to open a folder of chain files, then easily select, open, plot and compare, as well as viewing standard GetDist outputs and tables. -See the `GUI Readme `_. +See the `GUI Readme `_. Using with CosmoMC and Cobaya diff --git a/docs/source/gui.rst b/docs/source/gui.rst index 099010a..020a90a 100644 --- a/docs/source/gui.rst +++ b/docs/source/gui.rst @@ -7,9 +7,10 @@ It allows you to open a folder of chain files, then easily select, open, plot an .. image:: https://cdn.cosmologist.info/antony/getdist/gui_planck2018.png -It can open chain files under a selected directory structure (and also `paramgrid `_ directories as show above). +It can open chain files under a selected directory structure (and also `paramgrid `_ directories as show above, +or `Cobaya grids `_). See the `intro `_ for a description of chain file formats. A grid of sample chains files can be -downloaded `here `_, after downloading a file just unzip and open the main directory in the GUI. +downloaded `here `_, after downloading a file just unzip and open the main directory in the GUI. After opening a directory, you can select each chain root name you want to plot. It is then added to the list box below. The selected chains can be dragged and dropped to change the order if needed. Then select the parameter names to plot in the checkboxes below that, @@ -49,11 +50,11 @@ To run the GUI you need PySide. This is not included in default dependencies, bu pip install PySide6 -You can also use PySide2, e.g. using `Anaconda `_ to make a consistent new environment from conda-forge (which includes PySide2) e.g. :: +If you have conflicts, with Anaconda/miniconda you can make a consistent new environment +from conda-forge (which includes PySide6), e.g. :: - conda create -n py39forge -c conda-forge python=3.9 scipy matplotlib PyYAML PySide2 + conda create -n myenv -c conda-forge scipy matplotlib PyYAML PySide6 Once PySide is set up, (re)install getdist and you should then be able to use the getdist-gui script on your path. On a Mac the installation will also make a GetDist GUI Mac app, which you can find using Spotlight. -If you don't want to install dependencies locally, you can also use a pre-configured `virtual environment `_. diff --git a/getdist/chains.py b/getdist/chains.py index 9c80342..39b1352 100644 --- a/getdist/chains.py +++ b/getdist/chains.py @@ -1,12 +1,10 @@ import os import numpy as np import re -from packaging import version from getdist.paramnames import ParamNames, ParamInfo, escapeLatex from getdist.convolve import autoConvolve from getdist import cobaya_interface import pickle -import logging from copy import deepcopy from collections import namedtuple from typing import Sequence, Any, Optional, Union, List diff --git a/getdist/mcsamples.py b/getdist/mcsamples.py index 3bc44cb..f2c7a47 100644 --- a/getdist/mcsamples.py +++ b/getdist/mcsamples.py @@ -874,7 +874,7 @@ def getConvergeTests(self, test_confidence=0.95, writeDataToFile=False, - 'MeanVar': Gelman-Rubin sqrt(var(chain mean)/mean(chain var)) test in individual parameters (multiple chains only) - 'GelmanRubin': Gelman-Rubin test for the worst orthogonalized parameter (multiple chains only) - 'SplitTest': Crude test for variation in confidence limits when samples are split up into subsets - - 'RafteryLewis': `Raftery-Lewis test `_ (integer weight samples only) + - 'RafteryLewis': `Raftery-Lewis test `_ (integer weight samples only) - 'CorrLengths': Sample correlation lengths :param filename: The filename to write to, default is file_root.converge :param feedback: If set to True, Prints the output as well as returning it. @@ -1218,8 +1218,8 @@ def getAutoBandwidth1D(self, bins, par, param, mult_bias_correction_order=None, m = max(m, 1) if m: # higher order method - # e.g. http://biomet.oxfordjournals.org/content/82/2/327.full.pdf+html - # some prefactors given in http://eprints.whiterose.ac.uk/42950/6/taylorcc2%5D.pdf + # e.g. https://doi.org/10.1093/biomet/82.2.327 + # some prefactors given in https://eprints.whiterose.ac.uk/42950/6/taylorcc2%5D.pdf # Here we just take unit prefactor relative to Gaussian # and rescale the optimal h for standard KDE to accounts for higher order scaling # Should be about 1.3 x larger for Gaussian, but smaller in some other cases @@ -1359,7 +1359,7 @@ def _initParam(self, par, paramVec, mean=None, sddev=None, paramConfid=None): paramConfid = paramConfid or self.initParamConfidenceData(paramVec) # sigma_range is estimate related to shape of structure in the distribution = std dev for Gaussian # search for peaks using quantiles, - # e.g. like simplified version of Janssen 95 (http://dx.doi.org/10.1080/10485259508832654) + # e.g. like simplified version of Janssen 95 (https://dx.doi.org/10.1080/10485259508832654) confid_points = np.linspace(0.1, 0.9, 9) confids = self.confidence(paramConfid, np.array([self.range_confidence, 1 - self.range_confidence] + list(confid_points))) @@ -1555,7 +1555,7 @@ def get1DDensityGridData(self, j, paramConfid=None, meanlikes=False, **kwargs): raise SettingError('Unknown boundary_correction_order (expected 0, 1, 2)') elif boundary_correction_order == 2: # higher order kernel - # eg. see http://www.jstor.org/stable/2965571 + # eg. see https://www.jstor.org/stable/2965571 xWin2 = kernel.Win * kernel.x ** 2 x2P = convolve1D(bins, xWin2, 'same', cache=cache) a2 = np.sum(xWin2) @@ -1573,7 +1573,7 @@ def get1DDensityGridData(self, j, paramConfid=None, meanlikes=False, **kwargs): a0 = convolve1D(prior_mask, kernel.Win, 'same', cache=cache, cache_args=[2]) for _ in range(mult_bias_correction_order): # estimate using flattened samples to remove second order biases - # mostly good performance, see http://www.jstor.org/stable/2965571 method 3,1 for first order + # mostly good performance, see https://www.jstor.org/stable/2965571 method 3,1 for first order prob1 = density1D.P.copy() prob1[prob1 == 0] = 1 fine = bins / prob1 diff --git a/getdist/plots.py b/getdist/plots.py index 6ada99b..b71ca36 100644 --- a/getdist/plots.py +++ b/getdist/plots.py @@ -179,7 +179,6 @@ def __init__(self, subplot_size_inch: float = 2, fig_width_inch: Optional[float] self.constrained_layout = False self.no_triangle_axis_labels = True - # see http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps self.colormap = "Blues" self.colormap_scatter = "jet" self.colorbar_tick_rotation = None diff --git a/getdist/types.py b/getdist/types.py index 4714718..163ce9f 100644 --- a/getdist/types.py +++ b/getdist/types.py @@ -31,7 +31,7 @@ def times_ten_power(exponent): def float_to_decimal(f): - # http://docs.python.org/library/decimal.html#decimal-faq + # https://docs.python.org/library/decimal.html#decimal-faq """Convert a floating point number to a Decimal with no loss of information""" n, d = f.as_integer_ratio() numerator, denominator = decimal.Decimal(n), decimal.Decimal(d) @@ -46,7 +46,7 @@ def float_to_decimal(f): # noinspection PyUnboundLocalVariable def numberFigs(number, sigfig, sci=False): - # http://stackoverflow.com/questions/2663612/nicely-representing-a-floating-point-number-in-python/2663623#2663623 + # https://stackoverflow.com/questions/2663612/nicely-representing-a-floating-point-number-in-python/2663623#2663623 assert (sigfig > 0) try: d = decimal.Decimal(number) @@ -110,7 +110,7 @@ def namesigFigs(self, value, limplus, limminus, wantSign=True, sci=False): if sci: # First, call without knowing sig figs, to get the exponent exponent = self.formatNumber(max(abs(value - limminus), abs(value + limplus)), sci=True)[1] - if exponent: + if exponent = self.formatNumber(max(abs(value - limminus), abs(value + limplus)), sci=True)[1]: value, limplus, limminus = [ (lambda x: decimal.getcontext().multiply( float_to_decimal(x), float_to_decimal(10. ** -exponent)))(lim) diff --git a/getdist/yaml_tools.py b/getdist/yaml_tools.py index c801b12..f658c45 100644 --- a/getdist/yaml_tools.py +++ b/getdist/yaml_tools.py @@ -17,7 +17,7 @@ class InputSyntaxError(Exception): # Better loader for YAML # 1. Matches 1e2 as 100 (no need for dot, or sign after e), -# from http://stackoverflow.com/a/30462009 +# from https://stackoverflow.com/a/30462009 def yaml_load(text_stream, Loader=yaml.Loader, file_name=None): class ScientificLoader(Loader): pass