def run_analyze_dimension_and_radius(data, rmin, rmax, nradii, adjacency_method='<STR_LIT>', adjacency_kwds = {},<EOL>fit_range=None, savefig=False, plot_name = '<STR_LIT>'):
n, D = data.shape<EOL>radii = <NUM_LIT:10>**(np.linspace(np.log10(rmin), np.log10(rmax), nradii))<EOL>dists = compute_largest_radius_distance(data, rmax, adjacency_method, adjacency_kwds)<EOL>results = neighborhood_analysis(dists, radii)<EOL>avg_neighbors = results['<STR_LIT>'].flatten()<EOL>radii = results['<STR_LIT>'].flatten()<EOL>if fit_range is None:<EOL><INDENT>fit_range = range(len(radii))<EOL><DEDENT>dim = find_dimension_plot(avg_neighbors, radii, fit_range, savefig, plot_name)<EOL>return(results, dim)<EOL>
This function is used to estimate the doubling dimension (approximately equal to the intrinsic
dimension) by computing a graph of neighborhood radius versus average number of neighbors.

The "radius" refers to the truncation constant where all distances greater than
a specified radius are taken to be infinite. This is used for example in the
truncated Gaussian kernel in estimate_radius.py


Parameters
----------
data : numpy array,
    Original data set for which we are estimating the bandwidth
rmin : float,
    smallest radius to consider
rmax : float,
    largest radius to consider
nradii : int,
    number of radii between rmax and rmin to consider
adjacency_method : string,
    megaman adjacency method to use, default 'brute' see geometry.py for details
adjacency_kwds : dict,
    dictionary of keywords for adjacency method
fit_range : list of ints,
    range of radii to consider default is range(nradii), i.e. all of them
savefig: bool,
    whether to save the radius vs. neighbors figure
plot_name: string,
    filename of the figure to be saved as.

Returns
-------
results : dictionary
    contains the radii, average nieghbors, min and max number of neighbors and number
    of points with no neighbors.
dim : float,
    estimated doubling dimension (used as an estimate of the intrinsic dimension)