| |
- MJ(rho, c_s)
- # === return Jeans mass ===
- alpha_vir(rho, L, sigma_v, spherical=False)
- # === return virial parameter (spherical uniform-density approximation) ===
- check_for_overwrite(filename)
- comov2proper(redshift, q, qtype=None)
- # === for given redshift, convert co-moving quantity q with physical unit 'qtype' to proper quantity ===
- congrid(a, outshape, method='linear')
- # ================== similar to IDL congrid (2D only) ====================
- debug_decorator(func)
- # === Decorator to print the function signature and return value ===
- eform(x, prec=10, print_leading_plus=False)
- # === return x in E-format ===
- fit(func, xdata, ydata, weights=None, params=None, verbose=1, *args, **kwargs)
- # === START fit ===
# params should be a dict with the parameter name(s) and a list specifying [min, start, max]
- gauss_smooth(input_data, sigma=None, fwhm=None, mode='wrap')
- # === Smoothing a 2D array with a Gaussian kernel (sigma or fwhm in pixel units) ===
- generate_random_gaussian_numbers(n=100, mu=0.0, sigma=1.0, seed=None)
- # generates a numpy array with n Gaussian distributed random numbers based on mean mu and standard devitation sigma
- generate_random_uniform_numbers(n=100, min=0.0, max=1.0, seed=None)
- # generates a numpy array with n uniformly distributed random numbers based on min and max
- get_1d_coords(cmin=0, cmax=1, ndim=10, cell_centred=True)
- # return cell-centered coordinates | . | . |
# xmin xmax
# or face-centred if keyword cell_centred=False
- get_2d_coords(cmin=[0, 0], cmax=[1, 1], ndim=[10, 10], cell_centred=True)
- get_3d_coords(cmin=[0, 0, 0], cmax=[1, 1, 1], ndim=[10, 10, 10], cell_centred=True)
- get_binned_stats(data, bin_values, bins=None, statistic='mean', **kwargs)
- # === bin data with bin_values (same size as data) into bins (number or array of bin edges) ===
- get_coords(cmin, cmax, ndim, cell_centred=True)
- # this function takes lists or arrays as inputs,
# determining the dimensionality of the requested coordinates from the dimensionality of the inputs;
# for example, if cmin=[0,0], cmin=[1,1], ndim=[10,10], this function returns 2D corrdinates with 10 points in x=y=[0,1]
- get_dirs(dirname='.', include_base_dir=False, strip=False, verbose=1)
- # === function returning all sub-directories, including hidden dirs ===
- get_kde_sample(data, n=1000, seed=1, show=False)
- get_moments(x, y, xs=None, xe=None)
- # === return mean, stddev, skewness, kurtosis of input y(x) by integrating over x ===
- get_pdf(data, range=None, bins=200)
- # === get the PDF of data and return centred bin values ===
- get_sigma(mean, ms)
- # === return sigma from input mean and mean-square ===
- get_spectrum(data_in, ncmp=1)
- # === get the Fourier (k-space) spectrum of data with ncmp components in axis=0 ===
# === e.g., for a 64^3 dataset and 3 vector components, data.shape must be (3, 64, 64, 64) ===
# === e.g., for a 32^2 dataset with only 1 component, data.shape must be (32, 32) ===
- lJ(rho, c_s)
- # === return Jeans length ===
- mass(rho, L, spherical=False)
- # === return mass ===
- plot(y=None, x=None, yerr=None, xerr=None, type=None, xlabel='x', ylabel='y', label=None, marker=None, linestyle=None, linewidth=None, show=False, pause=None, xlog=False, ylog=False, xlim=None, ylim=None, save=None, legend_loc='upper left', text=None, shaded_err=None, *args, **kwargs)
- # === START plot ===
- plot_map(image=None, dims=None, vmin=None, vmax=None, log=False, colorbar=True, cmap='magma', cmap_label=None, xlabel=None, ylabel=None, extent=None, dpi=200, show=False, pause=None, save=None, *args, **kwargs)
- # === START plot_map ===
# function to plot a map (of a 2D numpy array)
- polytropic_eos(dens, mu=2.3)
- # === polytropic_eos START ===
- print(*args, error=False, warn=False, highlight=False, color='', no_prefix=False, **kwargs)
- # === START print ===
# custom print() function override to show caller (module and function) information before actual print string,
# plus options colourised output
- r_larmor(B, v, m=1.67262192369e-24, q=4.803204712570263e-10)
- # === Larmor radius ===
- read_ascii(filename, astropy_read=True, read_header=True, quiet=False, max_num_lines=10000000.0, plain=False, *args, **kwargs)
- # === read an ASCII file ===
# === select plain=True, to read each line into a list ===
- rebin(a, outshape)
- # ================== similar to IDL rebin (2D only) ====================
- replace_line_in_file(filename, search_str, new_line)
- # === function to search for a string pattern at the start of a line, and to replace that line ===
- round(x, nfigs=3, str_ret=False)
- # === return x rounded to nfigs significant figures ===
- round_with_error(val, val_err, nfigs=2)
- # round a value and its error (uncertainty) to given nfigs significant figures
- run_shell_command(cmd, quiet=False, print_only=False, capture=False, **kargs)
- # === executes a shell command: input string 'cmd'
- scale_factor(redshift)
- # === scale factor from redshift ===
- shock_jump_T(Mach, gamma=1.6666666666666667)
- # === return temperature Rankine-Hugoniot shock jump condition- ===
- shock_jump_p(Mach, gamma=1.6666666666666667)
- # === return pressure Rankine-Hugoniot shock jump condition- ===
- shock_jump_rho(Mach, gamma=1.6666666666666667)
- # === return density Rankine-Hugoniot shock jump condition- ===
- sigma_s(Mach, b=0.4, beta=1e+99)
- # === return sigma_s(Mach, b, beta) ===
- sink_dens_thresh(r_sink, c_s)
- smooth(x, y, window_npts=11, order=3)
- # smoothing/filtering data
- t_larmor(B, m=1.67262192369e-24, q=4.803204712570263e-10)
- # === Larmor time (time to gyrate once) ===
- tex_escape(text)
- # escape latex
- tff(rho)
- timer_decorator(func)
- # === Decorator to print the runtime of the decorated function ===
- write_ascii(filename, dat, format='fixed_width', delimiter='', comment=False, quiet=False, plain=False, *args, **kwargs)
- # === write an ASCII file ===
# === select plain=True, to write list (dat) with lines to file ===
|