lenstronomy.GalKin package¶
Submodules¶
lenstronomy.GalKin.analytic_kinematics module¶
-
class
lenstronomy.GalKin.analytic_kinematics.
AnalyticKinematics
(kwargs_cosmo, interpol_grid_num=100, log_integration=False, max_integrate=100, min_integrate=0.001)[source]¶ Bases:
lenstronomy.GalKin.anisotropy.Anisotropy
class to compute eqn 20 in Suyu+2010 with a Monte-Carlo from rendering from the light profile distribution and displacing them with a Gaussian seeing convolution
- This class assumes spherical symmetry in light and mass distribution and
- a Hernquist light profile (parameterised by the half-light radius)
- a power-law mass profile (parameterized by the Einstein radius and logarithmic slop)
The analytic equations for the kinematics in this approximation are presented e.g. in Suyu et al. 2010 and the spectral rendering approach to compute the seeing convolved slit measurement is presented in Birrer et al. 2016. The stellar anisotropy is parameterised based on Osipkov 1979; Merritt 1985.
all units are meant to be in angular arc seconds. The physical units are fold in through the angular diameter distances
-
static
draw_light
(kwargs_light)[source]¶ Parameters: kwargs_light – keyword argument (list) of the light model Returns: 3d radius (if possible), 2d projected radius, x-projected coordinate, y-projected coordinate
-
grav_potential
(r, kwargs_mass)[source]¶ Gravitational potential in SI units
Parameters: - r – radius (arc seconds)
- kwargs_mass –
Returns: gravitational potential
-
sigma_r2
(r, kwargs_mass, kwargs_light, kwargs_anisotropy)[source]¶ equation (19) in Suyu+ 2010
Parameters: - r – 3d radius
- kwargs_mass – mass profile keyword arguments
- kwargs_light – light profile keyword arguments
- kwargs_anisotropy – anisotropy keyword arguments
Returns: velocity dispersion in [m/s]
-
sigma_s2
(r, R, kwargs_mass, kwargs_light, kwargs_anisotropy)[source]¶ returns unweighted los velocity dispersion for a specified projected radius, with weight 1
Parameters: - r – 3d radius (not needed for this calculation)
- R – 2d projected radius (in angular units of arcsec)
- kwargs_mass – mass model parameters (following lenstronomy lens model conventions)
- kwargs_light – deflector light parameters (following lenstronomy light model conventions)
- kwargs_anisotropy – anisotropy parameters, may vary according to anisotropy type chosen. We refer to the Anisotropy() class for details on the parameters.
Returns: line-of-sight projected velocity dispersion at projected radius R from 3d radius r
lenstronomy.GalKin.anisotropy module¶
-
class
lenstronomy.GalKin.anisotropy.
Anisotropy
(anisotropy_type)[source]¶ Bases:
object
class that handles the kinematic anisotropy sources: Mamon & Lokas 2005 https://arxiv.org/pdf/astro-ph/0405491.pdf
Agnello et al. 2014 https://arxiv.org/pdf/1401.4462.pdf
-
K
(r, R, **kwargs)[source]¶ equation A16 im Mamon & Lokas for Osipkov&Merrit anisotropy
Parameters: - r – 3d radius
- R – projected 2d radius
- kwargs – parameters of the specified anisotropy model
Returns: K(r, R)
-
anisotropy_solution
(r, **kwargs)[source]¶ the solution to d ln(f)/ d ln(r) = 2 beta(r)
Parameters: - r – 3d radius
- kwargs – parameters of the specified anisotropy model
Returns: f(r)
-
-
class
lenstronomy.GalKin.anisotropy.
Const
[source]¶ Bases:
object
constant anisotropy model class See Mamon & Lokas 2005 for details
-
static
K
(r, R, beta)[source]¶ equation A16 im Mamon & Lokas for constant anisotropy
Parameters: - r – 3d radius
- R – projected 2d radius
- beta – anisotropy
Returns: K(r, R, beta)
-
static
-
class
lenstronomy.GalKin.anisotropy.
Isotropic
[source]¶ Bases:
object
class for isotropic (beta=0) stellar orbits See Mamon & Lokas 2005 for details
-
static
K
(r, R)[source]¶ equation A16 im Mamon & Lokas for constant anisotropy
Parameters: - r – 3d radius
- R – projected 2d radius
Returns: K(r, R)
-
static
-
class
lenstronomy.GalKin.anisotropy.
Radial
[source]¶ Bases:
object
class for radial (beta=1) stellar orbits See Mamon & Lokas 2005 for details
-
K
(r, R)[source]¶ equation A16 im Mamon & Lokas for constant anisotropy
Parameters: - r – 3d radius
- R – projected 2d radius
Returns: K(r, R)
-
-
class
lenstronomy.GalKin.anisotropy.
OsipkovMerritt
[source]¶ Bases:
object
class for Osipkov&Merrit stellar orbits See Mamon & Lokas 2005 for details
-
K
(r, R, r_ani)[source]¶ equation A16 im Mamon & Lokas 2005 for Osipkov&Merrit anisotropy
Parameters: - r – 3d radius
- R – projected 2d radius
- r_ani – anisotropy radius
Returns: K(r, R)
-
-
class
lenstronomy.GalKin.anisotropy.
GeneralizedOM
[source]¶ Bases:
object
generalized Osipkov&Merrit profile see Agnello et al. 2014 https://arxiv.org/pdf/1401.4462.pdf b(r) = beta_inf * r^2 / (r^2 + r_ani^2)
-
K
(r, R, r_ani, beta_inf)[source]¶ equation19 in Agnello et al. 2014 for k_beta(R, r) such that K(R, r) = (sqrt(r^2 - R^2) + k_beta(R, r)) / r
Parameters: - r – 3d radius
- R – projected 2d radius
- r_ani – anisotropy radius
- beta_inf – anisotropy at infinity
Returns: K(r, R)
-
anisotropy_solution
(r, r_ani, beta_inf)[source]¶ the solution to d ln(f)/ d ln(r) = 2 beta(r) See e.g. A5 in Mamon & Lokas with a scaling (nominator of Agnello et al. 2014 Equation (12)
Parameters: - r – 3d radius
- r_ani – anisotropy radius
- beta_inf – anisotropy at infinity
Returns: f(r)
-
-
class
lenstronomy.GalKin.anisotropy.
Colin
[source]¶ Bases:
object
class for stellar orbits anisotropy parameter based on Colin et al. (2000) See Mamon & Lokas 2005 for details
lenstronomy.GalKin.aperture module¶
-
class
lenstronomy.GalKin.aperture.
Aperture
(aperture_type, **kwargs_aperture)[source]¶ Bases:
object
defines mask(s) of spectra, can handle IFU and single slit/box type data.
-
aperture_select
(ra, dec)[source]¶ Parameters: - ra – angular coordinate of photon/ray
- dec – angular coordinate of photon/ray
Returns: bool, True if photon/ray is within the slit, False otherwise, int of the segment of the IFU
-
num_segments
¶
-
lenstronomy.GalKin.aperture_types module¶
-
class
lenstronomy.GalKin.aperture_types.
Slit
(length, width, center_ra=0, center_dec=0, angle=0)[source]¶ Bases:
object
Slit aperture description
-
aperture_select
(ra, dec)[source]¶ Parameters: - ra – angular coordinate of photon/ray
- dec – angular coordinate of photon/ray
Returns: bool, True if photon/ray is within the slit, False otherwise
-
num_segments
¶ number of segments with separate measurements of the velocity dispersion :return: int
-
-
lenstronomy.GalKin.aperture_types.
slit_select
(ra, dec, length, width, center_ra=0, center_dec=0, angle=0)[source]¶ Parameters: - ra – angular coordinate of photon/ray
- dec – angular coordinate of photon/ray
- length – length of slit
- width – width of slit
- center_ra – center of slit
- center_dec – center of slit
- angle – orientation angle of slit, angle=0 corresponds length in RA direction
Returns: bool, True if photon/ray is within the slit, False otherwise
-
class
lenstronomy.GalKin.aperture_types.
Frame
(width_outer, width_inner, center_ra=0, center_dec=0, angle=0)[source]¶ Bases:
object
rectangular box with a hole in the middle (also rectangular), effectively a frame
-
aperture_select
(ra, dec)[source]¶ Parameters: - ra – angular coordinate of photon/ray
- dec – angular coordinate of photon/ray
Returns: bool, True if photon/ray is within the slit, False otherwise
-
num_segments
¶ number of segments with separate measurements of the velocity dispersion :return: int
-
-
lenstronomy.GalKin.aperture_types.
frame_select
(ra, dec, width_outer, width_inner, center_ra=0, center_dec=0, angle=0)[source]¶ Parameters: - ra – angular coordinate of photon/ray
- dec – angular coordinate of photon/ray
- width_outer – width of box to the outer parts
- width_inner – width of inner removed box
- center_ra – center of slit
- center_dec – center of slit
- angle – orientation angle of slit, angle=0 corresponds length in RA direction
Returns: bool, True if photon/ray is within the box with a hole, False otherwise
-
class
lenstronomy.GalKin.aperture_types.
Shell
(r_in, r_out, center_ra=0, center_dec=0)[source]¶ Bases:
object
Shell aperture
-
aperture_select
(ra, dec)[source]¶ Parameters: - ra – angular coordinate of photon/ray
- dec – angular coordinate of photon/ray
Returns: bool, True if photon/ray is within the slit, False otherwise
-
num_segments
¶ number of segments with separate measurements of the velocity dispersion :return: int
-
-
lenstronomy.GalKin.aperture_types.
shell_select
(ra, dec, r_in, r_out, center_ra=0, center_dec=0)[source]¶ Parameters: - ra – angular coordinate of photon/ray
- dec – angular coordinate of photon/ray
- r_in – innermost radius to be selected
- r_out – outermost radius to be selected
- center_ra – center of the sphere
- center_dec – center of the sphere
Returns: boolean, True if within the radial range, False otherwise
-
class
lenstronomy.GalKin.aperture_types.
IFUShells
(r_bins, center_ra=0, center_dec=0)[source]¶ Bases:
object
class for an Integral Field Unit spectrograph with azimuthal shells where the kinematics are measured
-
aperture_select
(ra, dec)[source]¶ Parameters: - ra – angular coordinate of photon/ray
- dec – angular coordinate of photon/ray
Returns: bool, True if photon/ray is within the slit, False otherwise, index of shell
-
num_segments
¶ number of segments with separate measurements of the velocity dispersion :return: int
-
-
lenstronomy.GalKin.aperture_types.
shell_ifu_select
(ra, dec, r_bin, center_ra=0, center_dec=0)[source]¶ Parameters: - ra – angular coordinate of photon/ray
- dec – angular coordinate of photon/ray
- r_bin – array of radial bins to average the dispersion spectra in ascending order. It starts with the inner-most edge to the outermost edge.
- center_ra – center of the sphere
- center_dec – center of the sphere
Returns: boolean, True if within the radial range, False otherwise
lenstronomy.GalKin.cosmo module¶
-
class
lenstronomy.GalKin.cosmo.
Cosmo
(d_d, d_s, d_ds)[source]¶ Bases:
object
cosmological quantities
-
arcsec2phys_lens
(theta)[source]¶ converts are seconds to physical units on the deflector :param theta: angle observed on the sky in units of arc seconds :return: pyhsical distance of the angle in units of Mpc
-
epsilon_crit
¶ returns the critical projected mass density in units of M_sun/Mpc^2 (physical units)
-
lenstronomy.GalKin.galkin module¶
-
class
lenstronomy.GalKin.galkin.
Galkin
(kwargs_model, kwargs_aperture, kwargs_psf, kwargs_cosmo, kwargs_numerics=None, analytic_kinematics=False)[source]¶ Bases:
lenstronomy.GalKin.galkin_model.GalkinModel
,lenstronomy.GalKin.observation.GalkinObservation
Major class to compute velocity dispersion measurements given light and mass models
The class supports any mass and light distribution (and superposition thereof) that has a 3d correspondance in their 2d lens model distribution. For models that do not have this correspondance, you may want to apply a Multi-Gaussian Expansion (MGE) on their models and use the MGE to be de-projected to 3d.
The computation follows Mamon&Lokas 2005 and performs the spectral rendering of the seeing convolved apperture with the method introduced by Birrer et al. 2016.
The class supports various types of anisotropy models (see Anisotropy class) and aperture types (see Aperture class). Solving the Jeans Equation requires a numerical integral over the 3d light and mass profile (see Mamon&Lokas 2005). This class (as well as the dedicated LightModel and MassModel classes) perform those integral numerically with an interpolated grid.
The seeing convolved integral over the aperture is computed by rendering spectra (light weighted LOS kinematics) from the light distribution.
- The cosmology assumed to compute the physical mass and distances are set via the kwargs_cosmo keyword arguments.
- d_d: Angular diameter distance to the deflector (in Mpc) d_s: Angular diameter distance to the source (in Mpc) d_ds: Angular diameter distance from the deflector to the source (in Mpc)
The numerical options can be chosen through the kwargs_numerics keywords
interpol_grid_num: number of interpolation points in the light and mass profile (radially). This number should be chosen high enough to accurately describe the true light profile underneath. log_integration: bool, if True, performs the interpolation and numerical integration in log-scale.
max_integrate: maximum 3d radius to where the numerical integration of the Jeans Equation solver is made. This value should be large enough to contain most of the light and to lead to a converged result. min_integrate: minimal integration value. This value should be very close to zero but some mass and light profiles are diverging and a numerically stabel value should be chosen.
These numerical options should be chosen to allow for a converged result (within your tolerance) but not too conservative to impact too much the computational cost. Reasonable values might depend on the specific problem.
-
dispersion
(kwargs_mass, kwargs_light, kwargs_anisotropy, sampling_number=1000)[source]¶ computes the averaged LOS velocity dispersion in the slit (convolved)
Parameters: - kwargs_mass – mass model parameters (following lenstronomy lens model conventions)
- kwargs_light – deflector light parameters (following lenstronomy light model conventions)
- kwargs_anisotropy – anisotropy parameters, may vary according to anisotropy type chosen. We refer to the Anisotropy() class for details on the parameters.
- sampling_number – int, number of spectral sampling of the light distribution
Returns: integrated LOS velocity dispersion in units [km/s]
-
dispersion_map
(kwargs_mass, kwargs_light, kwargs_anisotropy, num_kin_sampling=1000, num_psf_sampling=100)[source]¶ computes the velocity dispersion in each Integral Field Unit
Parameters: - kwargs_mass – keyword arguments of the mass model
- kwargs_light – keyword argument of the light model
- kwargs_anisotropy – anisotropy keyword arguments
- num_kin_sampling – int, number of draws from a kinematic prediction of a LOS
- num_psf_sampling – int, number of displacements/render from a spectra to be displaced on the IFU
Returns: ordered array of velocity dispersions [km/s] for each unit
lenstronomy.GalKin.galkin_model module¶
-
class
lenstronomy.GalKin.galkin_model.
GalkinModel
(kwargs_model, kwargs_cosmo, kwargs_numerics=None, analytic_kinematics=False)[source]¶ Bases:
object
this class handles all the kinematic modeling aspects of Galkin Excluded are observational conditions (seeing, aperture etc) Major class to compute velocity dispersion measurements given light and mass models
The class supports any mass and light distribution (and superposition thereof) that has a 3d correspondance in their 2d lens model distribution. For models that do not have this correspondence, you may want to apply a Multi-Gaussian Expansion (MGE) on their models and use the MGE to be de-projected to 3d.
The computation follows Mamon&Lokas 2005.
The class supports various types of anisotropy models (see Anisotropy class). Solving the Jeans Equation requires a numerical integral over the 3d light and mass profile (see Mamon&Lokas 2005). This class (as well as the dedicated LightModel and MassModel classes) perform those integral numerically with an interpolated grid.
- The cosmology assumed to compute the physical mass and distances are set via the kwargs_cosmo keyword arguments.
- d_d: Angular diameter distance to the deflector (in Mpc) d_s: Angular diameter distance to the source (in Mpc) d_ds: Angular diameter distance from the deflector to the source (in Mpc)
The numerical options can be chosen through the kwargs_numerics keywords
interpol_grid_num: number of interpolation points in the light and mass profile (radially). This number should be chosen high enough to accurately describe the true light profile underneath. log_integration: bool, if True, performs the interpolation and numerical integration in log-scale.
max_integrate: maximum 3d radius to where the numerical integration of the Jeans Equation solver is made. This value should be large enough to contain most of the light and to lead to a converged result. min_integrate: minimal integration value. This value should be very close to zero but some mass and light profiles are diverging and a numerically stable value should be chosen.
These numerical options should be chosen to allow for a converged result (within your tolerance) but not too conservative to impact too much the computational cost. Reasonable values might depend on the specific problem.
-
check_df
(r, kwargs_mass, kwargs_light, kwargs_anisotropy)[source]¶ checks whether the phase space distribution function of a given anisotropy model is positive. Currently this is implemented by the relation provided by Ciotti and Morganti 2010 equation (10) https://arxiv.org/pdf/1006.2344.pdf
Parameters: - r – 3d radius to check slope-anisotropy constraint
- theta_E – Einstein radius in arc seconds
- gamma – power-law slope
- a_ani – scaled transition radius of the OM anisotropy distribution
- r_eff – half-light radius in arc seconds
Returns: equation (10) >= 0 for physical interpretation
lenstronomy.GalKin.light_profile module¶
-
class
lenstronomy.GalKin.light_profile.
LightProfile
(profile_list, interpol_grid_num=2000, max_interpolate=1000, min_interpolate=0.001, max_draw=None)[source]¶ Bases:
object
class to deal with the light distribution for GalKin
- In particular, this class allows for:
- (faster) interpolated calculation for a given profile (for a range that the Jeans equation is computed)
- drawing 3d and 2d distributions from a given (spherical) profile (within bounds where the Jeans equation is expected to be accurate)
- 2d projected profiles within the 3d integration range (truncated)
-
delete_cache
()[source]¶ deletes cached interpolation function of the CDF for a specific light profile
Returns: None
-
draw_light_2d
(kwargs_list, n=1, new_compute=False)[source]¶ constructs the CDF and draws from it random realizations of projected radii R CDF is constructed in logarithmic projected radius spacing
Parameters: - kwargs_list – light model keyword argument list
- n – int, number of draws per functino call
- new_compute – re-computes the interpolated CDF
Returns: realization of projected radius following the distribution of the light model
-
draw_light_2d_linear
(kwargs_list, n=1, new_compute=False)[source]¶ constructs the CDF and draws from it random realizations of projected radii R The interpolation of the CDF is done in linear projected radius space
Parameters: - kwargs_list – list of keyword arguments of light profiles (see LightModule)
- n – int; number of draws
- new_compute – boolean, if True, re-computes the interpolation (becomes valid with updated kwargs_list argument)
Returns: draw of projected radius for the given light profile distribution
-
draw_light_3d
(kwargs_list, n=1, new_compute=False)[source]¶ constructs the CDF and draws from it random realizations of 3D radii r
Parameters: - kwargs_list – light model keyword argument list
- n – int, number of draws per function call
- new_compute – re-computes the interpolated CDF
Returns: realization of projected radius following the distribution of the light model
-
light_2d
(R, kwargs_list)[source]¶ projected light profile (integrated to infinity in the projected axis)
Parameters: - R – projected 2d radius
- kwargs_list – list of keyword arguments of light profiles (see LightModule)
Returns: projected surface brightness
-
light_2d_finite
(R, kwargs_list)[source]¶ projected light profile (integrated to FINITE 3d boundaries from the max_interpolate)
Parameters: - R – projected 2d radius (between min_interpolate and max_interpolate
- kwargs_list – list of keyword arguments of light profiles (see LightModule)
Returns: projected surface brightness
-
light_3d
(r, kwargs_list)[source]¶ three-dimensional light profile
Parameters: - r – 3d radius
- kwargs_list – list of keyword arguments of light profiles (see LightModule)
Returns: flux per 3d volume at radius r
-
light_3d_interp
(r, kwargs_list, new_compute=False)[source]¶ interpolated three-dimensional light profile within bounds [min_interpolate, max_interpolate] in logarithmic units with interpol_grid_num numbers of interpolation steps
Parameters: - r – 3d radius
- kwargs_list – list of keyword arguments of light profiles (see LightModule)
- new_compute – boolean, if True, re-computes the interpolation (becomes valid with updated kwargs_list argument)
Returns: flux per 3d volume at radius r
lenstronomy.GalKin.numeric_kinematics module¶
-
class
lenstronomy.GalKin.numeric_kinematics.
NumericKinematics
(kwargs_model, kwargs_cosmo, interpol_grid_num=1000, log_integration=True, max_integrate=1000, min_integrate=0.0001, max_light_draw=None, lum_weight_int_method=True)[source]¶ Bases:
lenstronomy.GalKin.anisotropy.Anisotropy
-
delete_cache
()[source]¶ delete interpolation function for a specific mass and light profile as well as for a specific anisotropy model
Returns:
-
draw_light
(kwargs_light)[source]¶ Parameters: kwargs_light – keyword argument (list) of the light model Returns: 3d radius (if possible), 2d projected radius, x-projected coordinate, y-projected coordinate
-
grav_potential
(r, kwargs_mass)[source]¶ Gravitational potential in SI units
Parameters: - r – radius (arc seconds)
- kwargs_mass –
Returns: gravitational potential
-
mass_3d
(r, kwargs)[source]¶ mass enclosed a 3d radius
Parameters: - r – in arc seconds
- kwargs – lens model parameters in arc seconds
Returns: mass enclosed physical radius in kg
-
sigma_r2
(r, kwargs_mass, kwargs_light, kwargs_anisotropy)[source]¶ computes numerically the solution of the Jeans equation for a specific 3d radius E.g. Equation (A1) of Mamon & Lokas https://arxiv.org/pdf/astro-ph/0405491.pdf l(r) sigma_r(r) ^ 2 = 1/f(r) int_r^{infty} f(s) l(s) G M(s) / s^2 ds where l(r) is the 3d light profile M(s) is the enclosed 3d mass f is the solution to d ln(f)/ d ln(r) = 2 beta(r)
Parameters: - r – 3d radius
- kwargs_mass – mass model parameters (following lenstronomy lens model conventions)
- kwargs_light – deflector light parameters (following lenstronomy light model conventions)
- kwargs_anisotropy – anisotropy parameters, may vary according to anisotropy type chosen. We refer to the Anisotropy() class for details on the parameters.
Returns: sigma_r**2
-
sigma_s2
(r, R, kwargs_mass, kwargs_light, kwargs_anisotropy)[source]¶ returns unweighted los velocity dispersion for a specified 3d and projected radius (if lum_weight_int_method=True then the 3d radius is not required and the function directly performs the luminosity weighted integral in projection at R)
Parameters: - r – 3d radius (not needed for this calculation)
- R – 2d projected radius (in angular units of arcsec)
- kwargs_mass – mass model parameters (following lenstronomy lens model conventions)
- kwargs_light – deflector light parameters (following lenstronomy light model conventions)
- kwargs_anisotropy – anisotropy parameters, may vary according to anisotropy type chosen. We refer to the Anisotropy() class for details on the parameters.
Returns: weighted line-of-sight projected velocity dispersion at projected radius R with weights I
-
sigma_s2_project
(R, kwargs_mass, kwargs_light, kwargs_anisotropy)[source]¶ returns luminosity-weighted los velocity dispersion for a specified projected radius R and weight
Parameters: - R – 2d projected radius (in angular units of arcsec)
- kwargs_mass – mass model parameters (following lenstronomy lens model conventions)
- kwargs_light – deflector light parameters (following lenstronomy light model conventions)
- kwargs_anisotropy – anisotropy parameters, may vary according to anisotropy type chosen. We refer to the Anisotropy() class for details on the parameters.
Returns: line-of-sight projected velocity dispersion at projected radius R
-
sigma_s2_r
(r, R, kwargs_mass, kwargs_light, kwargs_anisotropy)[source]¶ returns unweighted los velocity dispersion for a specified 3d radius r at projected radius R
Parameters: - r – 3d radius (not needed for this calculation)
- R – 2d projected radius (in angular units of arcsec)
- kwargs_mass – mass model parameters (following lenstronomy lens model conventions)
- kwargs_light – deflector light parameters (following lenstronomy light model conventions)
- kwargs_anisotropy – anisotropy parameters, may vary according to anisotropy type chosen. We refer to the Anisotropy() class for details on the parameters.
Returns: line-of-sight projected velocity dispersion at projected radius R from 3d radius r
-
lenstronomy.GalKin.observation module¶
-
class
lenstronomy.GalKin.observation.
GalkinObservation
(kwargs_aperture, kwargs_psf)[source]¶ Bases:
lenstronomy.GalKin.psf.PSF
,lenstronomy.GalKin.aperture.Aperture
this class sets the base for the observational properties (aperture and seeing condition)
lenstronomy.GalKin.psf module¶
-
class
lenstronomy.GalKin.psf.
PSF
(psf_type, **kwargs_psf)[source]¶ Bases:
object
general class to handle the PSF in the GalKin module for rendering the displacement of photons/spectro
lenstronomy.GalKin.velocity_util module¶
-
lenstronomy.GalKin.velocity_util.
hyp_2F1
(a, b, c, z)[source]¶ http://docs.sympy.org/0.7.1/modules/mpmath/functions/hypergeometric.html
-
lenstronomy.GalKin.velocity_util.
displace_PSF_gaussian
(x, y, FWHM)[source]¶ Parameters: - x – x-coord (arc sec)
- y – y-coord (arc sec)
- FWHM – psf size (arc sec)
Returns: x’, y’ random displaced according to psf
-
lenstronomy.GalKin.velocity_util.
moffat_r
(r, alpha, beta)[source]¶ Moffat profile
Parameters: - r – radial coordinate
- alpha – Moffat parameter
- beta – exponent
Returns: Moffat profile
-
lenstronomy.GalKin.velocity_util.
moffat_fwhm_alpha
(FWHM, beta)[source]¶ computes alpha parameter from FWHM and beta for a Moffat profile
Parameters: - FWHM – full width at half maximum
- beta – beta parameter of Moffat profile
Returns: alpha parameter of Moffat profile
-
lenstronomy.GalKin.velocity_util.
draw_moffat_r
(FWHM, beta)[source]¶ Parameters: - FWHM – full width at half maximum
- beta – Moffat beta parameter
Returns: draw from radial Moffat distribution
-
lenstronomy.GalKin.velocity_util.
displace_PSF_moffat
(x, y, FWHM, beta)[source]¶ Parameters: - x – x-coordinate of light ray
- y – y-coordinate of light ray
- FWHM – full width at half maximum
- beta – Moffat beta parameter
Returns: displaced ray by PSF
-
lenstronomy.GalKin.velocity_util.
draw_cdf_Y
(beta)[source]¶ Draw c.d.f for Moffat function according to Berge et al. Ufig paper, equation B2 cdf(Y) = 1-Y**(1-beta)
Returns:


Click here to go to the corresponding page for the latest version of DIALS
About¶
The DIALS software is developed in a fully open-source, collaborative environment. The main development teams are based at Diamond Light Source and CCP4, in the UK, and at Lawrence Berkeley National Laboratory, USA. However, in the spirit of the open source movement, we welcome collaboration from anyone who wishes to contribute to the project.
To avoid “reinventing the wheel” as much as possible, the DIALS project builds on knowledge accumulated over many decades in the field of crystallographic data processing. We benefit greatly from the altruism of experts who contribute their ideas and advice, either directly or via their detailed publications on existing algorithms and packages such as XDS [2] and MOSFLM [3]. At the heart of the DIALS framework lies a design philosophy of hardware abstraction and a generalised model of the experiment that is inspired directly by material published on the seminal workshops on position sensitive detector software [1]. Continuing in the spirit of these workshops we held our own series of meetings, with talks from invited speakers, and code camps in which specific problems are addressed by intensive effort across the collaboration. Summaries of these meetings and copies of slides given as presentations are available here.
DIALS is written using Python and C++, making heavy use of the cctbx [4] for core crystallographic calculations and much infrastructure including a complete build system. Seamless interaction between the C++ and Python components of this hybrid system is enabled by Boost.Python. Python provides a useful ground for rapid prototyping, after which core algorithms and data structures may be transferred over to C++ for speed. High level interfaces of the hybrid system remain in Python, facilitating further development and code reuse both within DIALS and by third parties.
Development Teams¶
DIALS East¶
Development of DIALS in the UK is funded by the Wellcome Trust, Diamond Light Source and CCP4, and led by Dr Gwyndaf Evans.
DIALS West¶
Development of DIALS at Lawrence Berkeley National Laboratory, USA is led by Dr Nicholas Sauter and supported by National Institutes of Health / National Institute of General Medical Sciences grant R01-GM117126: DIALS: New Computational Methods to Enable Challenging Crystallographic Experiments. Work at LBNL is performed under Department of Energy contract DE-AC02-05CH11231.

Contributors include:
Aaron Brewster
Asmit Bhowmick
Benjamin Williams
Billy Poon
David Waterman
Derek Mendez
Graeme Winter
Ian Rees
Iris Young
James Beilsten-Edmands
James Parkhurst
Johan Hattne
Katrin Leinweber
Lee James O'Riordan
Luis Fuentes-Montero
Marcin Wojdyr
Markus Gerstel
Nathaniel Echols
Nicholas Devenish
Nicholas Sauter
Nigel Moriarty
Oliver Zeldin
Richard Gildea
Robert Bolotovsky
Takanori Nakane
Tara Michels-Clark
In addition, we acknowledge guidance and ideas gained through numerous intellectual discussions with the following:
Alun Ashton, Gleb Bourenkov, Gerard Bricogne, Phil Evans, Andrew Leslie, Nigel Moriarty, Garib Murshudov, Jim Pflugrath, Harry Powell, Jon Schuermann and Matthew Webber.
| [1] | Bricogne, G. (1987). Proceedings of the CCP4 Daresbury Study Weekend, pp. 120-145. |
| [2] | Kabsch, W. (2010). Acta Cryst. D66, 125-132. |
| [3] | Leslie, A. G. W. and Powell H. R. (2007), Evolving Methods for Macromolecular Crystallography, 245, 41-51. ISBN 978-1-4020-6314-5. |
| [4] | Grosse-Kunstleve, R. W., Sauter, N. K., Moriarty, N. W., & Adams, P. D. (2002). Journal of Applied Crystallography. 35, 126–136. |


We're a team of mission-driven experts and learners who are committed to making security a strength for every startup.
We've already helped hundreds of innovative companies succeed at becoming trustworthy custodians of sensitive data. And we're just getting started.
Our oppurtinity
Excepteur sint occaecat cupidatat non proident sunt in culpa qui anim officia.
Watch the videoOur team
Architecto beatae vitae dicta sunt explicabo ipsam memo voluptatem quia voluptas.
Meet the teamOur culture
Corporis suscipit laboriosa nisi ut aliquid ex ea commodi consequatur pariatur.
See our valuesOpen positions
Solutions engineer (entry level) |
Sales - Stockholm | Apply for this job |
Sales Development Representative |
Sales - London | Apply for this job |
Software Engineer - Backend |
Product & Engineering - Stockholm | Apply for this job |


Say hello to your 24th birthday
Dear love,
On this day was born one beautiful Princess
Today’s a great day.
You make today a day to look forward to because,
without you,
today
has more
meaning.
You make my life more awesome.
I’m glad to have you and proud to celebrate
you
today.
I pray your days are
spent happily.
Happy birthday to you, my girlfriend.


Thango was name of a man. This place is to the west of Chura waro. Here water would always be present. When sometimes water would finish, Thango would dig for 3-4 feet and water would appear. For the future, he prepared a 10 feet deep well, which had water till recently but now Bahria has taken over that land. 1000s of livestock would drink water from there. Thango loved his livestock, cared for them, was very hardworking. he belonged to Gabol clan. The place where water is available naturally is called chakhor in balochi, hence this place came to be known as thango chakhor?


Dear and Beloved, Brother and Sister, XXLASTNAME and etc- I take this opportunity to communicate, some of my feelings, privately at this time, which I want you three eternally to keep in your own bosoms; for my feelings are so strong for you since what has passed lately between us, that the time of my absence from you seems so long, and dreary, that it seems, as if I could not live long in this way: and if you three would come and see me in this my lonely retreat, it would afford me great relief, of mind, if those with whom I am allied, do love me, now is the time to afford me succor, in the days of exile, for you know I foretold you of these things. I am now at Carlos Grainger’s, just back of Brother XXFIRSTNAME’s farm, it is only one mile form town, the nights are very pleasant indeed, all three of you can come and see me in the fore part of the night, let Brother XXLASTNAME come a little ahead, and knock at the south east corner of the house at the window; it is next to the cornfield; I have a room entirely by myself, the whole matter can be attended to with most perfect safety, I know it is the will of God that you should comfort me now in this time of affliction, or not at all now is the time or never, but I have no need of saying any such thing, to you, for I know the goodness of your hearts, and that you will do the will of the Lord, when it is made known to you; the only thing to be careful of; is to find out when XXFIRSTNAME comes then you cannot be safe, but when she is not here, there is the most perfect safety: only be careful to escape observation, as much as possible, I know it is a heroic undertaking; but so much the greater friendship, and the more joy, when I see you I will tell you all my plans, I cannot write them on paper, burn this letter as soon as you read it, keep all locked up in your breasts, my life depends upon it, one thing I want to see you for is to get the fulness of my blessings sealed upon our heads, etc. You will pardon me for my earnestness on this subject when you consider how lonesome I must be, your good feelings know how to make every allowance for me, I close my letter, I think XXFIRSTNAME won’t come tonight if she don’t, don’t fail to come tonight.


TravelEasy
First Name
Last Name
Email
Mobile
Password
Confirm Password
Already have an account? Click to Log in
By signing up, you agree to Travel Easy's Terms and Conditions.


Accommodations | Activities | Travel Arrangements | Photos | Contact
Enjoy these and many more activities on site and nearby!
Swimming in our above ground pool.
Table tennis and billiards.
Biweekly bingo nights.
Local bus tours.
Shuttle services to:
- Shopping
- Rite Aid
- Public transit center
- Note: Shuttle service to the airport is not available at this time.


Hello, welcome! I am Lacy.
A Little Bit About Me
My name is Lacy Hogan.
Education
- Excelsior College Albany, NY 2015 - B.S. in Liberal Arts
- Grantham University Lenexa, KS 2009 - A.S. in Business Administration
- Community College of the Air Force Montgomery, AL 2008 - A.S. in Contract Management
Top 5 Favorite Movies
- Dazed and Confused
- Out Cold
- Gross Point Blank
- Prncess Bride
- Donnie Darko


Welcome to the site.
All data pulled from the USDA National Nutrient Database for Standard Reference
Search by nutrient type and conditional. ex: Carbs < 50 grams and protein > 10 grams.
Curious about a certain food or looking for something specific? I'm your guy.
Research shows a multitude of benefits both physical and mental.
Energy you need to keep active throughout the day
Nutrients you need for growth and repair, helping you to stay strong and healthy and help to prevent diet-related illness
Reduce your risk of heart disease by maintaining blood pressure and cholesterol levels
Keeps your teeth and bones strong and can help to slow bone loss (osteoporosis) associated with getting older
Can help you maintain a steady weight
Ketogenic diet: Less than 50g of carbs per day.
Zone diet: Meals consisting of 40 percent carbs, 30 percent protein and 30 percent fats.
Bulk diet: Daily intake of grams protein equivalent to weight in pounds of person who is dieting.
Paleo diet: Any food that our hunter-gatherer ancestors would have eaten. No dairy, grains, legumes, refined sugars, or processed foods.


Lily is a junior studying Symbolic Systems.
Everyone knows being last in a line is bummer. Lily tried to make those moments of standing in the back of the less less unpleasent by giving people a delicious chocolate before entering the line to distract them. The goal was that by the time the person finished the chocolate, they would no longer be the last person in line.
I stood in a line to get tickets to a Zuckerberg talk next week. I stood there for 20 minutes and observed. I developed this point of view/need: make the back of the line less unpleasent
Give free samples or treats to customers as they enter the back of the line
Testing was difficult inside the Stanford bookstore.


Russia re-enacts legendary Second World War parade in Moscow
by The Associated Press, StaffMOSCOW -- Russian troops clad in Secon dWorld War-era uniforms marched Thursday across Moscow's Red Square in a reconstruction of a legendary wartime parade.
The Nov. 7, 1941, parade saw Red Army soldiers move directly to the front line in the Battle of Moscow, becoming a symbol of Soviet valour and tenacity in the face of overwhelming odds.
The Nazi forces approached Moscow in October 1941 as the Red Army suffered a series of devastating defeats after the Nazi invasion of the Soviet Union on June 22, 1941. They came as close as 30 kilometres to the city in some areas and Nazi officers were able to see Moscow's landmarks in binoculars.
As Moscow's fate was hanging in the balance, Soviet leader Josef Stalin ordered the parade to boost morale of the city's defenders. The Soviet command eventually managed to bring in fresh troops from the country's east and launch a counteroffensive that drove the Nazis back. It was the Nazis' first major defeat since the start of the Second World War.
Thursday's re-enactment featured about 4,000 troops, vintage T-34 tanks and other vehicles.
During Soviet times, annual military parades were held on Nov. 7 to mark the anniversary of the 1917 Bolshevik Revolution. The holiday was abolished in 2005, but communist party members still celebrate it.


{%extends "base.html"%} {% block script %} {% include "tablesorter_script.html" %} {% endblock %} {% block breadcrumb %} | List {{ expense_type }}s {% endblock %} {%block about_this_page %}
These are the {{ expense_type }} records for {{ user.program_selected }}.
To create a new {{ expense_type }}, start from the Site page
(because every
{{ expense_type }} must be associated with a Site).
{% endblock %}
{%block body%}
{% include table_template %}
{%endblock%}


Action Controllers are the core of a web request in Rails. They are made up of one or more actions that are executed on request and then either render a template or redirect to another action. An action is defined as a public method on the controller, which will automatically be made accessible to the web-server through Rails Routes.
A sample controller could look like this:
class GuestBookController < ActionController::Base def index @entries = Entry.find(:all) end def sign Entry.create(params[:entry]) redirect_to :action => "index" end end
Actions, by default, render a template in the app/views directory corresponding to the name of the controller and action after executing code in the action. For example, the index action of the GuestBookController would render the template app/views/guestbook/index.rhtml by default after populating the @entries instance variable.
Unlike index, the sign action will not render a template. After performing its main purpose (creating a new entry in the guest book), it initiates a redirect instead. This redirect works by returning an external "302 Moved" HTTP response that takes the user to the index action.
The index and sign represent the two basic action archetypes used in Action Controllers. Get-and-show and do-and-redirect. Most actions are variations of these themes.
Requests are processed by the Action Controller framework by extracting the value of the "action" key in the request parameters. This value should hold the name of the action to be performed. Once the action has been identified, the remaining request parameters, the session (if one is available), and the full request with all the http headers are made available to the action through instance variables. Then the action is performed.
The full request object is available with the request accessor and is primarily used to query for http headers. These queries are made by accessing the environment hash, like this:
def server_ip location = request.env["SERVER_ADDR"] render :text => "This server hosted at #{location}" end
All request parameters, whether they come from a GET or POST request, or from the URL, are available through the params method which returns a hash. For example, an action that was performed through /weblog/list?category=All&limit=5 will include { "category" => "All", "limit" => 5 } in params.
It’s also possible to construct multi-dimensional parameter hashes by specifying keys using brackets, such as:
<input type="text" name="post[name]" value="david"> <input type="text" name="post[address]" value="hyacintvej">
A request stemming from a form holding these inputs will include { "post" => { "name" => "david", "address" => "hyacintvej" } }. If the address input had been named "post[address][street]", the params would have included { "post" => { "address" => { "street" => "hyacintvej" } } }. There’s no limit to the depth of the nesting.
Sessions allows you to store objects in between requests. This is useful for objects that are not yet ready to be persisted, such as a Signup object constructed in a multi-paged process, or objects that don’t change much and are needed all the time, such as a User object for a system that requires login. The session should not be used, however, as a cache for objects where it’s likely they could be changed unknowingly. It’s usually too much work to keep it all synchronized — something databases already excel at.
You can place objects in the session by using the session method, which accesses a hash:
session[:person] = Person.authenticate(user_name, password)
And retrieved again through the same hash:
Hello #{session[:person]}
For removing objects from the session, you can either assign a single key to nil, like session[:person] = nil, or you can remove the entire session with reset_session.
By default, sessions are stored on the file system in RAILS_ROOT/tmp/sessions. Any object can be placed in the session (as long as it can be Marshalled). But remember that 1000 active sessions each storing a 50kb object could lead to a 50MB store on the filesystem. In other words, think carefully about size and caching before resorting to the use of the session on the filesystem.
An alternative to storing sessions on disk is to use ActiveRecordStore to store sessions in your database, which can solve problems caused by storing sessions in the file system and may speed up your application. To use ActiveRecordStore, uncomment the line:
config.action_controller.session_store = :active_record_store
in your environment.rb and run rake db:sessions:create.
Each action results in a response, which holds the headers and document to be sent to the user’s browser. The actual response object is generated automatically through the use of renders and redirects and requires no user intervention.
Action Controller sends content to the user by using one of five rendering methods. The most versatile and common is the rendering of a template. Included in the Action Pack is the Action View, which enables rendering of ERb templates. It’s automatically configured. The controller passes objects to the view by assigning instance variables:
def show @post = Post.find(params[:id]) end
Which are then automatically available to the view:
Title: <%= @post.title %>
You don’t have to rely on the automated rendering. Especially actions that could result in the rendering of different templates will use the manual rendering methods:
def search @results = Search.find(params[:query]) case @results when 0 then render :action => "no_results" when 1 then render :action => "show" when 2..10 then render :action => "show_many" end end
Read more about writing ERb and Builder templates in classes/ActionView/Base.html.
Redirects are used to move from one action to another. For example, after a create action, which stores a blog entry to a database, we might like to show the user the new entry. Because we’re following good DRY principles (Don‘t Repeat Yourself), we’re going to reuse (and redirect to) a show action that we’ll assume has already been created. The code might look like this:
def create @entry = Entry.new(params[:entry]) if @entry.save # The entry was saved correctly, redirect to show redirect_to :action => 'show', :id => @entry.id else # things didn't go so well, do something else end end
In this case, after saving our new entry to the database, the user is redirected to the show method which is then executed.
An action should conclude with a single render or redirect. Attempting to try to do either again will result in a DoubleRenderError:
def do_something redirect_to :action => "elsewhere" render :action => "overthere" # raises DoubleRenderError end
If you need to redirect on the condition of something, then be sure to add "and return" to halt execution.
def do_something redirect_to(:action => "elsewhere") and return if monkeys.nil? render :action => "overthere" # won't be called unless monkeys is nil end
| DEFAULT_RENDER_STATUS_CODE | = | "200 OK" | ||
| DEPRECATED_INSTANCE_VARIABLES | = | %w(flash params session) | TODO: assigns cookies headers params request response template |
| action_name | [RW] | Returns the name of the action this controller is processing. |
| assigns | [RW] | Holds the hash of variables that are passed on to the template class to be made available to the view. This hash is generated by taking a snapshot of all the instance variables in the current scope just before a template is rendered. |
| headers | [RW] | Holds a hash of header names and values. Accessed like headers["Cache-Control"] to get the value of the Cache-Control directive. Values should always be specified as strings. |
| request | [RW] | Holds the request object that’s primarily used to get environment variables through access like request.env["REQUEST_URI"]. |
| response | [RW] | Holds the response object that’s primarily used to set additional HTTP headers through access like response.headers["Cache-Control"] = "no-cache". Can also be used to access the final body HTML after a template has been rendered through response.body — useful for after_filters that wants to manipulate the output, such as a OutputCompressionFilter. |
Converts the class name from something like "OneModule::TwoModule::NeatController" to "NeatController".
# File vendor/rails/actionpack/lib/action_controller/base.rb, line 325 325: def controller_class_name 326: @controller_class_name ||= name.demodulize 327: end
Converts the class name from something like "OneModule::TwoModule::NeatController" to "neat".
# File vendor/rails/actionpack/lib/action_controller/base.rb, line 330 330: def controller_name 331: @controller_name ||= controller_class_name.sub(/Controller$/, '').underscore 332: end
Converts the class name from something like "OneModule::TwoModule::NeatController" to "one_module/two_module/neat".
# File vendor/rails/actionpack/lib/action_controller/base.rb, line 335 335: def controller_path 336: @controller_path ||= name.gsub(/Controller$/, '').underscore 337: end
Replace sensitive paramater data from the request log. Filters paramaters that have any of the arguments as a substring. Looks in all subhashes of the param hash for keys to filter. If a block is given, each key and value of the paramater hash and all subhashes is passed to it, the value or key can be replaced using String#replace or similar method.
Examples:
filter_parameter_logging => Does nothing, just slows the logging process down filter_parameter_logging :password => replaces the value to all keys matching /password/i with "[FILTERED]" filter_parameter_logging :foo, "bar" => replaces the value to all keys matching /foo|bar/i with "[FILTERED]" filter_parameter_logging { |k,v| v.reverse! if k =~ /secret/i } => reverses the value to all keys matching /secret/i filter_parameter_logging(:foo, "bar") { |k,v| v.reverse! if k =~ /secret/i } => reverses the value to all keys matching /secret/i, and replaces the value to all keys matching /foo|bar/i with "[FILTERED]"
# File vendor/rails/actionpack/lib/action_controller/base.rb, line 375 375: def filter_parameter_logging(*filter_words, &block) 376: parameter_filter = Regexp.new(filter_words.collect{ |s| s.to_s }.join('|'), true) if filter_words.length > 0 377: 378: define_method(:filter_parameters) do |unfiltered_parameters| 379: filtered_parameters = {} 380: 381: unfiltered_parameters.each do |key, value| 382: if key =~ parameter_filter 383: filtered_parameters[key] = '[FILTERED]' 384: elsif value.is_a?(Hash) 385: filtered_parameters[key] = filter_parameters(value) 386: elsif block_given? 387: key, value = key.dup, value.dup 388: yield key, value 389: filtered_parameters[key] = value 390: else 391: filtered_parameters[key] = value 392: end 393: end 394: 395: filtered_parameters 396: end 397: end
Return an array containing the names of public methods that have been marked hidden from the action processor. By default, all methods defined in ActionController::Base and included modules are hidden. More methods can be hidden using hide_actions.
# File vendor/rails/actionpack/lib/action_controller/base.rb, line 342 342: def hidden_actions 343: write_inheritable_attribute(:hidden_actions, ActionController::Base.public_instance_methods) unless read_inheritable_attribute(:hidden_actions) 344: read_inheritable_attribute(:hidden_actions) 345: end
Hide each of the given methods from being callable as actions.
# File vendor/rails/actionpack/lib/action_controller/base.rb, line 348 348: def hide_action(*names) 349: write_inheritable_attribute(:hidden_actions, hidden_actions | names.collect { |n| n.to_s }) 350: end
Process a request extracted from an CGI object and return a response. Pass false as session_options to disable sessions (large performance increase if sessions are not needed). The session_options are the same as for CGI::Session:
# File vendor/rails/actionpack/lib/action_controller/cgi_process.rb, line 25 25: def self.process_cgi(cgi = CGI.new, session_options = {}) 26: new.process_cgi(cgi, session_options) 27: end
Process a test request called with a TestRequest object.
# File vendor/rails/actionpack/lib/action_controller/test_process.rb, line 6 6: def self.process_test(request) 7: new.process_test(request) 8: end
Converts the class name from something like "OneModule::TwoModule::NeatController" to "NeatController".
# File vendor/rails/actionpack/lib/action_controller/base.rb, line 506 506: def controller_class_name 507: self.class.controller_class_name 508: end
Converts the class name from something like "OneModule::TwoModule::NeatController" to "neat".
# File vendor/rails/actionpack/lib/action_controller/base.rb, line 511 511: def controller_name 512: self.class.controller_name 513: end
Converts the class name from something like "OneModule::TwoModule::NeatController" to "one_module/two_module/neat".
# File vendor/rails/actionpack/lib/action_controller/base.rb, line 516 516: def controller_path 517: self.class.controller_path 518: end
# File vendor/rails/actionpack/lib/action_controller/test_process.rb, line 14 14: def process_with_test(*args) 15: returning process_without_test(*args) do 16: add_variables_to_assigns 17: end 18: end
# File vendor/rails/actionpack/lib/action_controller/base.rb, line 520 520: def session_enabled? 521: request.session_options[:disabled] != false 522: end
Returns a URL that has been rewritten according to the options hash and the defined Routes. (For doing a complete redirect, use redirect_to). url_for is used to: All keys given to url_for are forwarded to the Route module, save for the following:
The URL is generated from the remaining keys in the hash. A URL contains two key parts: the <base> and a query string. Routes composes a query string as the key/value pairs not included in the <base>.
The default Routes setup supports a typical Rails path of "controller/action/id" where action and id are optional, with action defaulting to ‘index’ when not given. Here are some typical url_for statements and their corresponding URLs:
url_for :controller => 'posts', :action => 'recent' # => 'proto://host.com/posts/recent' url_for :controller => 'posts', :action => 'index' # => 'proto://host.com/posts' url_for :controller => 'posts', :action => 'show', :id => 10 # => 'proto://host.com/posts/show/10'
When generating a new URL, missing values may be filled in from the current request’s parameters. For example, url_for :action => ‘some_action‘ will retain the current controller, as expected. This behavior extends to other parameters, including :controller, :id, and any other parameters that are placed into a Route’s path. The URL helpers such as url_for have a limited form of memory: when generating a new URL, they can look for missing values in the current request’s parameters. Routes attempts to guess when a value should and should not be taken from the defaults. There are a few simple rules on how this is performed:
The final rule is applied while the URL is being generated and is best illustrated by an example. Let us consider the route given by map.connect ‘people/:last/:first/:action’, :action => ‘bio’, :controller => ‘people’.
Suppose that the current URL is "people/hh/david/contacts". Let’s consider a few different cases of URLs which are generated from this page.
last components, and the action shall change. The generated URL will be, "people/hh/david/bio".
However, you might ask why the action from the current request, ‘contacts’, isn’t carried over into the new URL. The answer has to do with the order in which the parameters appear in the generated path. In a nutshell, since the value that appears in the slot for :first is not equal to default value for :first we stop using defaults. On it’s own, this rule can account for much of the typical Rails URL behavior. Although a convienence, defaults can occasionaly get in your way. In some cases a default persists longer than desired. The default may be cleared by adding :name => nil to url_for’s options. This is often required when writing form helpers, since the defaults in play may vary greatly depending upon where the helper is used from. The following line will redirect to PostController’s default action, regardless of the page it is displayed on:
url_for :controller => 'posts', :action => nil
If you explicitly want to create a URL that’s almost the same as the current URL, you can do so using the :overwrite_params options. Say for your posts you have different views for showing and printing them. Then, in the show view, you get the URL for the print view like this
url_for :overwrite_params => { :action => 'print' }
This takes the current URL as is and only exchanges the action. In contrast, url_for :action => ‘print’ would have slashed-off the path components after the changed action.
# File vendor/rails/actionpack/lib/action_controller/base.rb, line 486 486: def url_for(options = {}, *parameters_for_method_reference) #:doc: 487: case options 488: when String 489: options 490: 491: when Symbol 492: ActiveSupport::Deprecation.warn( 493: "You called url_for(:#{options}), which is a deprecated API call. Instead you should use the named " + 494: "route directly, like #{options}(). Using symbols and parameters with url_for will be removed from Rails 2.0.", 495: caller 496: ) 497: 498: send(options, *parameters_for_method_reference) 499: 500: when Hash 501: @url.rewrite(rewrite_options(options)) 502: end 503: end
Overwrite to implement a number of default options that all url_for-based methods will use. The default options should come in the form of a hash, just like the one you would use for url_for directly. Example:
def default_url_options(options) { :project => @project.active? ? @project.url_name : "unknown" } end
As you can infer from the example, this is mostly useful for situations where you want to centralize dynamic decisions about the urls as they stem from the business domain. Please note that any individual url_for call can always override the defaults set by this method.
# File vendor/rails/actionpack/lib/action_controller/base.rb, line 859 859: def default_url_options(options) #:doc: 860: end
Sets a HTTP 1.1 Cache-Control header. Defaults to issuing a "private" instruction, so that intermediate caches shouldn’t cache the response.
Examples:
expires_in 20.minutes expires_in 3.hours, :private => false expires in 3.hours, 'max-stale' => 5.hours, :private => nil, :public => true
This method will overwrite an existing Cache-Control header. See www.w3.org/Protocols/rfc2616/rfc2616-sec14.html for more possibilities.
# File vendor/rails/actionpack/lib/action_controller/base.rb, line 918 918: def expires_in(seconds, options = {}) #:doc: 919: cache_options = { 'max-age' => seconds, 'private' => true }.symbolize_keys.merge!(options.symbolize_keys) 920: cache_options.delete_if { |k,v| v.nil? or v == false } 921: cache_control = cache_options.map{ |k,v| v == true ? k.to_s : "#{k.to_s}=#{v.to_s}"} 922: response.headers["Cache-Control"] = cache_control.join(', ') 923: end
Sets a HTTP 1.1 Cache-Control header of "no-cache" so no caching should occur by the browser or intermediate caches (like caching proxy servers).
# File vendor/rails/actionpack/lib/action_controller/base.rb, line 927 927: def expires_now #:doc: 928: response.headers["Cache-Control"] = "no-cache" 929: end
Redirects the browser to the target specified in options. This parameter can take one of three forms:
Examples:
redirect_to :action => "show", :id => 5 redirect_to "http://www.rubyonrails.org" redirect_to "/images/screenshot.jpg" redirect_to :back
The redirection happens as a "302 Moved" header.
When using redirect_to :back, if there is no referrer, RedirectBackError will be raised. You may specify some fallback behavior for this case by rescueing RedirectBackError.
# File vendor/rails/actionpack/lib/action_controller/base.rb, line 881 881: def redirect_to(options = {}, *parameters_for_method_reference) #:doc: 882: case options 883: when %r{^\w+://.*} 884: raise DoubleRenderError if performed? 885: logger.info("Redirected to #{options}") if logger 886: response.redirect(options) 887: response.redirected_to = options 888: @performed_redirect = true 889: 890: when String 891: redirect_to(request.protocol + request.host_with_port + options) 892: 893: when :back 894: request.env["HTTP_REFERER"] ? redirect_to(request.env["HTTP_REFERER"]) : raise(RedirectBackError) 895: 896: else 897: if parameters_for_method_reference.empty? 898: redirect_to(url_for(options)) 899: response.redirected_to = options 900: else 901: # TOOD: Deprecate me! 902: redirect_to(url_for(options, *parameters_for_method_reference)) 903: response.redirected_to, response.redirected_to_method_params = options, parameters_for_method_reference 904: end 905: end 906: end
Renders the content that will be returned to the browser as the response body.
Action rendering is the most common form and the type used automatically by Action Controller when nothing else is specified. By default, actions are rendered within the current layout (if one exists).
# Renders the template for the action "goal" within the current controller render :action => "goal" # Renders the template for the action "short_goal" within the current controller, # but without the current active layout render :action => "short_goal", :layout => false # Renders the template for the action "long_goal" within the current controller, # but with a custom layout render :action => "long_goal", :layout => "spectacular"
Deprecation notice: This used to have the signatures render_action("action", status = 200), render_without_layout("controller/action", status = 200), and render_with_layout("controller/action", status = 200, layout).
Partial rendering in a controller is most commonly used together with Ajax calls that only update one or a few elements on a page without reloading. Rendering of partials from the controller makes it possible to use the same partial template in both the full-page rendering (by calling it from within the template) and when sub-page updates happen (from the controller action responding to Ajax calls). By default, the current layout is not used.
# Renders the same partial with a local variable. render :partial => "person", :locals => { :name => "david" } # Renders a collection of the same partial by making each element # of @winners available through the local variable "person" as it # builds the complete response. render :partial => "person", :collection => @winners # Renders the same collection of partials, but also renders the # person_divider partial between each person partial. render :partial => "person", :collection => @winners, :spacer_template => "person_divider" # Renders a collection of partials located in a view subfolder # outside of our current controller. In this example we will be # rendering app/views/shared/_note.r(html|xml) Inside the partial # each element of @new_notes is available as the local var "note". render :partial => "shared/note", :collection => @new_notes # Renders the partial with a status code of 500 (internal error). render :partial => "broken", :status => 500
Note that the partial filename must also be a valid Ruby variable name, so e.g. 2005 and register-user are invalid.
Deprecation notice: This used to have the signatures render_partial(partial_path = default_template_name, object = nil, local_assigns = {}) and render_partial_collection(partial_name, collection, partial_spacer_template = nil, local_assigns = {}).
Template rendering works just like action rendering except that it takes a path relative to the template root. The current layout is automatically applied.
# Renders the template located in [TEMPLATE_ROOT]/weblog/show.r(html|xml) (in Rails, app/views/weblog/show.rhtml) render :template => "weblog/show"
File rendering works just like action rendering except that it takes a filesystem path. By default, the path is assumed to be absolute, and the current layout is not applied.
# Renders the template located at the absolute filesystem path render :file => "/path/to/some/template.rhtml" render :file => "c:/path/to/some/template.rhtml" # Renders a template within the current layout, and with a 404 status code render :file => "/path/to/some/template.rhtml", :layout => true, :status => 404 render :file => "c:/path/to/some/template.rhtml", :layout => true, :status => 404 # Renders a template relative to the template root and chooses the proper file extension render :file => "some/template", :use_full_path => true
Deprecation notice: This used to have the signature render_file(path, status = 200)
Rendering of text is usually used for tests or for rendering prepared content, such as a cache. By default, text rendering is not done within the active layout.
# Renders the clear text "hello world" with status code 200 render :text => "hello world!" # Renders the clear text "Explosion!" with status code 500 render :text => "Explosion!", :status => 500 # Renders the clear text "Hi there!" within the current active layout (if one exists) render :text => "Explosion!", :layout => true # Renders the clear text "Hi there!" within the layout # placed in "app/views/layouts/special.r(html|xml)" render :text => "Explosion!", :layout => "special"
The :text option can also accept a Proc object, which can be used to manually control the page generation. This should generally be avoided, as it violates the separation between code and content, and because almost everything that can be done with this method can also be done more cleanly using one of the other rendering methods, most notably templates.
# Renders "Hello from code!" render :text => proc { |response, output| output.write("Hello from code!") }
Deprecation notice: This used to have the signature render_text("text", status = 200)
Rendering of an inline template works as a cross between text and action rendering where the source for the template is supplied inline, like text, but its interpreted with ERb or Builder, like action. By default, ERb is used for rendering and the current layout is not used.
# Renders "hello, hello, hello, again" render :inline => "<%= 'hello, ' * 3 + 'again' %>" # Renders "<p>Good seeing you!</p>" using Builder render :inline => "xml.p { 'Good seeing you!' }", :type => :rxml # Renders "hello david" render :inline => "<%= 'hello ' + name %>", :locals => { :name => "david" }
Deprecation notice: This used to have the signature render_template(template, status = 200, type = :rhtml)
In addition to rendering JavaScriptGenerator page updates with Ajax in RJS templates (see ActionView::Base for details), you can also pass the :update parameter to render, along with a block, to render page updates inline.
render :update do |page| page.replace_html 'user_list', :partial => 'user', :collection => @users page.visual_effect :highlight, 'user_list' end
Rendering nothing is often convenient in combination with Ajax calls that perform their effect client-side or when you just want to communicate a status code. Due to a bug in Safari, nothing actually means a single space.
# Renders an empty response with status code 200 render :nothing => true # Renders an empty response with status code 401 (access denied) render :nothing => true, :status => 401
# File vendor/rails/actionpack/lib/action_controller/base.rb, line 672 672: def render(options = nil, deprecated_status = nil, &block) #:doc: 673: raise DoubleRenderError, "Can only render or redirect once per action" if performed? 674: 675: if options.nil? 676: return render_file(default_template_name, deprecated_status, true) 677: else 678: # Backwards compatibility 679: unless options.is_a?(Hash) 680: if options == :update 681: options = { :update => true } 682: else 683: ActiveSupport::Deprecation.warn( 684: "You called render('#{options}'), which is a deprecated API call. Instead you use " + 685: "render :file => #{options}. Calling render with just a string will be removed from Rails 2.0.", 686: caller 687: ) 688: 689: return render_file(options, deprecated_status, true) 690: end 691: end 692: end 693: 694: if content_type = options[:content_type] 695: headers["Content-Type"] = content_type.to_s 696: end 697: 698: if text = options[:text] 699: render_text(text, options[:status]) 700: 701: else 702: if file = options[:file] 703: render_file(file, options[:status], options[:use_full_path], options[:locals] || {}) 704: 705: elsif template = options[:template] 706: render_file(template, options[:status], true) 707: 708: elsif inline = options[:inline] 709: render_template(inline, options[:status], options[:type], options[:locals] || {}) 710: 711: elsif action_name = options[:action] 712: ActiveSupport::Deprecation.silence do 713: render_action(action_name, options[:status], options[:layout]) 714: end 715: 716: elsif xml = options[:xml] 717: render_xml(xml, options[:status]) 718: 719: elsif partial = options[:partial] 720: partial = default_template_name if partial == true 721: if collection = options[:collection] 722: render_partial_collection(partial, collection, options[:spacer_template], options[:locals], options[:status]) 723: else 724: render_partial(partial, ActionView::Base::ObjectWrapper.new(options[:object]), options[:locals], options[:status]) 725: end 726: 727: elsif options[:update] 728: add_variables_to_assigns 729: @template.send :evaluate_assigns 730: 731: generator = ActionView::Helpers::PrototypeHelper::JavaScriptGenerator.new(@template, &block) 732: render_javascript(generator.to_s) 733: 734: elsif options[:nothing] 735: # Safari doesn't pass the headers of the return if the response is zero length 736: render_text(" ", options[:status]) 737: 738: else 739: render_file(default_template_name, options[:status], true) 740: 741: end 742: end 743: end
Renders according to the same rules as render, but returns the result in a string instead of sending it as the response body to the browser.
# File vendor/rails/actionpack/lib/action_controller/base.rb, line 747 747: def render_to_string(options = nil, &block) #:doc: 748: result = ActiveSupport::Deprecation.silence { render(options, &block) } 749: 750: erase_render_results 751: forget_variables_added_to_assigns 752: reset_variables_added_to_assigns 753: 754: result 755: end
Resets the session by clearing out all the objects stored within and initializing a new session object.
# File vendor/rails/actionpack/lib/action_controller/base.rb, line 932 932: def reset_session #:doc: 933: request.reset_session 934: @_session = request.session 935: response.session = @_session 936: end


BBS.SYS
BBS.SYS (\FBB\SYSTEM).
This file is in SYSTEM directory. In this file you MUST put the callsign of
every BBS you will forward directly to. There must be 80 (from 1 to 80)
lines, even if you do not use them all. The format is very critical, so do
NOT change line-arrangement !
All the BBSs you forward to (the callsigns after A in FORWARD.SYS) must also
be in BBS.SYS. Before you start your BBS for the first time, you should
remove all not-used callsigns in BBS.SYS, and put in the file only the BBSs
that you forward to in your FORWARD.SYS. Later it is recommended that you do
NOT replace one callsign with another, as messages then will go to the wrong
BBS.
This file should speak for itself.
##########################
# BBS.SYS for FBB 7.00 #
# for LA6CU BBS by LA6CU #
##########################
#
# File containing all BBSs we forward to.
#
# Make sure that NO numbers are removed.
#
01 LA1B
02 F6FBB
03 AMSAT
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
This page was last updated


This tests that we won't crash when a plugin tries to open an URL in a new window when the application does not create the window. If this test is successful, the word SUCCESS should be seen below.
FAILED


JS is inserted into an HTML document using the <script>
tag.
JS should be added within the <body>
element but after all other content (this is to ensure all content loads before the script runs).
While JS can be added directly into the <script>
tag, it is best practice to link a reference file, like this:
<script>src="main.js"</script>
To see what your JS is outputting, you can view the console.
In Firefox, the console is accessible through the shortcut ctrl + shift + k
.
You can display to the console directly with the command:
console.log();
In JS, we have three ways to set variables:
var
let
const
var
You don't want to use var
anymore because it's global in scope.
Now let
and const
are the new standards.
let
The let
variable can be changed and reassigned.
const
The const
variable stays constant once it is set. Any attempts to change it will produce an error.
Good rule of thumb: unless you know you'll be changing a variable down the line, use const
instead of let
.
In JS, primitive data types refer to things written directly to the computer. They include:
String
Numbers
Boolean
null
undefined
String
Strings are a series of characters enclosed in either double or single quotes.
For example:
const name = 'John';
Numbers
Numbers are any number without any quotes.
For example:
const name = 30;
Boolean
Booleans are variables with either a true
or false
value.
For example:
const name = true;
null
Null only includes the quoteless value null
, and essentially indicates that a field is empty.
For example:
const x = null;
undefined
Undefined is a variable similar to null
, but if we use let
we don't need to explicitly define it.
For example:
const y = undefined;
or:
let z;
Typingng any of these variables to the console using console.log()
will return their variable type.
For example:
console.log(z);
will return:
undefined
If we want to mix other variable types (or even other strings) in with astring, we can use a method called "concatenation."
There are two ways to do this.
Concatenation is the older, more tedious method and uses quotes and plus signs, like this:
const name = 'John';
const age = 30;
console.log('My name is' + name + ' and I am' + age);
which would output:
My name is John and I am 30
The more modern method is to use "Template Literals", which employ backticks, dollar signs and curly braces, like this:
const name = 'John';
const age = 30;
console.log(`My name is ${name} and I am ${age}`);
which also outputs:
My name is John and I am 30
Properties and Methods are ways to evaluate or manipulate strings. They are denoted by a name, and appended to string variables with a period.
Properties do not have parentheses. If it's something that looks like a property and has parentheses it's a method.
.length
The .length property counts the number of characters in a given string.
For example:
const s = 'Hello World!';
console.log(s.length);
will output:
12
.toUpperCase
& .toLowerCase
The .toUpperCase & .toLowerCase methods convert a given string to either all upper or all lowercase characters.
For example:
const s = 'Hello World!';
console.log(s.toUpperCase());
console.log(s.toLowerCase());
will output:
HELLO WORLD!
hello world!
.subString
The .subString method will isolate a specific range of characters from the larger string, and output it as a separate sub-string.
Within the method parentheses you need to specify the starting and ending index, which is separated by a comma.
For example:
const s = 'Hello World!';
console.log(s.subString(0, 5));
will output:
Hello
.split
The .split method will split a given string into an array (more on those later).
Within the inner parentheses, you can specify how you'd like to split the string.
For example, to split by each letter, you would use empty quotes.
Meaning:
const s = 'Hello World!';
console.log(s.split(''));
will output:
["H", "e", "l", "l", "o", " ", "W", "o", "r", "l", "d", "!"]
You can also define any kind of separator.
For example, if you wanted to create an array out of tags within a blog post, all separated by commas, you could define your separator as .split(', ')
, which would break up each of the tags into separate array elements.
Let's say you had:
const s = 'technology, computers, it, code';
console.log(s.split(', '));
It would output:
["technology", "computers", "it", "code"]
Arrays are variables that hold multiple values.

The first is not so common, but we'll review it anyways.
This uses the new
keyword, which lets us know what comes agter is a constructor.
In this case we have:
const numbers = new Array(1,2,3,4,5);
Now if we go:
console.log(numbers);
Then we get an array with 5 values:
[1, 2, 3, 4, 5]
For the most part, you're going to create an array by just setting the brackets and populating it with items.
For example:
const fruits = ['apples', 'oranges', 'pears'];
One important thing is that you can mix data types within the same array.
For example:
const fruits = ['apples', 'oranges', 'pears', true, 2];
This is also a perfectly valid array.
Now, let's say we want to pull out just one item from our list of fruits.
We can do this as follows:
const fruits = ['apples', 'oranges', 'pears'];
console.log(fruits[1]);
Which would output:
oranges
Two important things to note here.
Another thing we can do is add an item to an array.
The way we would do this is as follows:
const fruits = ['apples', 'oranges', 'pears'];
fruits[3] = 'grapes';
Now when we call fruits
back up…
console.log(fruits);
We get:
["apples", "oranges", "pears", "grapes"]
.push
and .unshift
methods)The previous method works fine if you know how many items are in your array, but what if you don't? Or what if you want to add to the beginning of an array?
In that case, you can use the .push
and .unshift
methods to append a new array item to the end or beginning of a string respectively. All without needing to specify a number.
For example:
const fruits = ['apples', 'oranges', 'pears'];
fruits.push('mangoes');
fruits.unshift('strawberries');
Now when we call fruits
back up…
console.log(fruits);
We get:
["strawberries", "apples", "oranges", "pears", "mangoes"]
What if we want to knock the last item off a list?
.pop
method does exactly that.What if we want to find what number within an array a certain value is?
.indexOf
method allows you to input any value and returns its index.What if we want to squeeze new elements in to an existing array, and/or cut out other elements in the process?
.splice
element does just that. The first two parameters are numbers, which define the position where the new elements are to be inserted and how many elements should be removed. The rest of the parameters define the new elements to be added.Even more array methods can be found here.
Object literals are essentially key value pairs grouped under a single constant.
So let's do something simple like a person:
const person = {
firstName: 'John',
lastName: 'Doe',
age: 30,
hobbies: ['music', 'movies', 'sports'],
address: {
street: '50 main st',
city: 'Boston',
state: 'MA'
}
};
Now, if we log the variable person
, it will return all of these things.
Meaning:
console.log(person);
Outputs the following object:
{ firstName: 'John', lastName: 'Doe', age: 30, hobbies: ['music', 'movies', 'sports'], address: {street: '50 main st', city: 'Boston', state: 'MA'}};
An important thing to note about the above object, is that it can contain any variable type (and can even include other objects within it!)
Let's say we want to just pull a single value from a given object.
In our case we can simply append another property to the given object name, like this:
console.log(person.firstName);
Which will output:
John
You can also output multiple values this way, by separating them with a comma.
For example:
console.log(person.firstName, person.lastName);
Which will output:
John Doe
Another thing you can do is nab a single item from an array that is within an object.
For example:
console.log(person.hobbies[1]);
Will output:
movies
That's because 'movies'
was the second item in the hobbies
array, meaning it had an index of 1
.
You can also freely add new properties to an existing object.
Just append a new property to the existing object with a period, then define it with an equal sign.
For example:
person.email =<EMAIL_ADDRESS>Will add the new value of email
to the existing object person
.
Alot of the time, we'll be dealing with arrays of objects, and these are simple to create.
Take the following 'todo' array:
const todos = [
{
id: 1,
text: 'Take out trash',
isCompleted: true
},
{
id: 2,
text: 'Meeting with boss',
isCompleted: true
},
{
id: 3,
text: 'Dentist appt',
isCompleted: false
},
];
Now, let's say you wanted to grab the text from todo item number two.
Easy enough:
console.log(todos[1].text);
Will output:
Meeting with boss
A quick aside about JSON
JSON is a very popular for full-stack development and using APIs.
When you're sending data to a server, you usually send it in JSON.
The thing is, it's very similar to object literals, and you can convert between the tools using free tools like these.
When you do this conversion, you'll see the syntax between a JS object array and JSON is very similar (only difference is only double quotes in JSON).
So, what if you want to convert your JS object to JSON directly in your script?
Turns out it's very easy.
The way you do it is as follows:
const todoJSON = JSON.stringify(todos);
Outputting this to a
console.log
will produce a fully JSON version of the original JS object array.And this is how you would send that data to a server.
.
For Loops are structured as follows:
for()
: declares that a for loop is starting.let i = 0;
: defines a variable and establishes a starting condition (in this case of 0),i < 10;
: sets up a condition to check against after each iteration of the loop. As soon as this expression comes up false, the loop will stop.i++
: this establishes an iterator that will change the variable after each loop (in this case ++
= add 1). Without an iterator, the loop will run forever.console.log(i);
: this will print out the value for our variable after each loop. We can choose to have it print a variety of things to console.Now here it is all together:
for(let i = 0; i < 10; i++) {
console.log(i);
}
While Loops are structured as follows:
let i = 0;
: similar to a for loop, here we are setting up a variable for a starting point. Only in this case, we set it up outside the loop itself.while(i < 10){}
: here we are establishing the condition under which the loop will run. The second this statement becomes false, the loop will stop.console.log(i);
: this instructs what the loop will output to console.i++;
: much like the for loop, it's key to include an iterator within the while loop, otherwise it will run endlessly.Now here it is all together:
let i=0;
while(i < 10) {
console.log(i);
i++;
}
For of loops are a much more efficient way of looping through object arrays, like this:
const todos = [
{
id: 1,
text: 'Take out trash',
isCompleted: true
},
{
id: 2,
text: 'Meeting with boss',
isCompleted: true
},
{
id: 3,
text: 'Dentist appt',
isCompleted: false
},
];
For of loops are structured as follows:
for()
: this indicates that a for loop is starting.let todo
: this creates a new variable we will iterate on.of todos
: this allows our iterator to reference our existing object array.{console.log(todo.text);}
: this will cause our console to print the text variable from each object in the array.Now here it is all together:
for(let todo of todos) {
console.log(todo.text);
}
These are the best methods to use when trying to iterate on arrays.
.forEach
The .forEach
method is structured as follows:
todos.forEach()
: this targets a specific array and declares the method.(function(todo))
: all higher order array methods take in a function as a parameter, so we pass in a function. This callback function can take in multiple parameters, but the first one is going to be the variable that you want to use as each item, (or in this case each todo).{console.log(todo.text);}
: then this will output the text for each todo.Now here it is all together:
todos.forEach(function(todo) {
console.log(todo.text);
});
map
The .map
method is structured as follows:
const todoText =
: this method actually returns an array, so you need to assign a new variable. Because what we're doing is looping through and the return an array of just the text values.
todos.map
: this declares the method for the given object.
(function(todo)
: this establishes the function we'll take in as our first parameter.
{return todo.text;});
: this returns the text for each instance of the todo function that is mapping to the todos array.
Now here it is all together:
const todoText = todos.map(function(todo) {
return todo.text;
});
filter
The .filter
method is structured as follows:
const todoCompleted =
: this method actually returns an array, so you need to assign a new variable. Because what we're doing is looping through and the return an array of just the values that meet a certain condition.
todos.filter
: this declares the method for the given object.
(function(todo)
: this establishes the function we'll take in as our first parameter.
{return todo.isCompleted === true;});
: this returns the values for each instance object in the todos array that meets our filter criteria.
Now here it is all together:
const todoCompleted = todos.filter(function(todo) {
return todo.isCompleted === true;
});
We can also chain these methods together.
For example, if I just wanted the text of the array items we filtered as true, we could add .map
to the end of the entire .filter
function above:
const todoCompleted = todos.filter(function(todo) {
return todo.isCompleted === true;
}).map (function(todo) {
return todo.text;
});
Conditionals allow us to set certain logical conditions for our functions.
else if
For example, let's say:
const x = 10;
So…
if(x === 10) {
console.log('x is 10');
}
(the difference between the
===
and the==
is that the double equal just measures equal value whereas triple equal also measures data type)
We can also account for the counterfactual with
else {
console.log('x is NOT 10');
}
These statements can be strung together to account for multiple contingencies by using else if
.
For example:
if(x === 10) {
console.log('x is 10');
} else if(x > 10) {
console.log('x is greater than 10');
} else {
console.log('x is less than 10');
}
Ternary operators are a shorthand for the else if
conditional.
They are structured as follows:
const x = 11;
const color = x > 10 ? 'red' : 'blue';
In this case, logging the console will return red
, because the variable x
meets the condition > 10
.
switch
conditionalsSwitches are another way to evaluate a condition, which unlike ternaries are more suited to evaluating multiple cases.
They are structured as follows:
switch(color) {
case 'red':
console.log('color is red');
break;
case 'blue':
console.log('color is blue');
break;
default:
console.log('color is NOT red or blue');
break;
}


--- title: "AS9138 Sampling Tables" author: "Jameson Marriott" date: "2018-12-06" output: blogdown::html_page: toc: true fig_width: 6 dev: "svg" draft: TRUE ---
AS9138 Quality Management Systems Statistical Product Acceptance Requirements provides new guidance on inspection samplings for accepting and rejecting product that replaces the old MIL-STD-105 sample plans. The old plans focused more on protecting the producer than the consumer with an “acceptible quality limit” (AQL) and also allowed lots to be shipped with discrepent parts included. The new plan focuses on consumer protection with an “average outgoing quality limit” (AOQL) instead and also takes advantage of smaller sample sizes that are possible when lots are screened 100% when discrepencies are found.
For more information on why and how you should transition from the old sample plans to the new AS9138, see section 3.7.8 of the AIQG Supply Chain Management Handbook.
Let’s take a look at the difference in sample sizes between a common MIL-STD-105 AQL 1.5 plan and the new AS9138 AOQL of 1.9 that is equivalent in consumer protection according to AS9138.
# import the tidyverse
library(tidyverse)


Loading
Home
Welcome [$Rank$] $Username$
$ACC_TYPE$ Account Settings
Account Details
E-mail Address
Username
Update Password
Update Password
Personal Details
Name
Surname
Age
Contact Number
Activity details
Search History
Registration Date
My Referral Code
Referred User
Membership Details
Active Membership
Adverts
Active
Searches Remaining
0
Qualify Free Trial
Yes
Total Months paid for membership
0
Upgrade Membership
Account Management
Recovery Email
Update Email
Disable account
Enable account
Support


Odds on White Christmas in UK slashed by bookies
It would be the first time since 2010 that snow has fallen on Christmas Day
by Jamie HawkinsBookies have slashed the odds on the UK having a White Christmas for the first time in nine years.
Coral are offering odds of 4/5 that the UK will have a White Christmas in 2019 with forecasters predicting that snow will begin to fall as early as this week.
But what actually counts towards a White Christmas?
If there’s snowfall on Buckingham Palace, Aldergrove Airport in Belfast, Pittodrie Stadium in Aberdeen, Edinburgh Castle, Manchester’s Coronation Street or the Millennium Stadium in Cardiff that will count towards a bookie’s payout just as well.
William Hill has also revealed odds on a White Christmas at some UK airports, including one in Cornwall.
The bookmaker has current odds of snow on Christmas Day at Penzance (RNAS Culdrose) at 12/1.
Coral's Harry Aitkenhead told the Daily Star: ""The big winter freeze is about to get underway and there's a definite chance of the next few months breaking the record for the coldest winter since records began.
"Snow is set to sprinkle over the UK in the next week and it's raising excitement about the prospect of a White Christmas this year. We currently make it odds on that we do get a dash of the white stuff somewhere in the UK on the big day."
What is a white Christmas?
The definition that the Met Office uses to define a white Christmas is for one snowflake to be observed falling in the 24 hours of 25 December somewhere in the UK.
Traditionally we used to use a single location in the country to define a white Christmas, which was the Met Office building in London. However, with the increase in betting on where will see a white Christmas, the number of locations have increased and can now include sites such as Buckingham Palace, Belfast (Aldergrove Airport), Aberdeen (Pittodrie Stadium, Aberdeen FC), Edinburgh (Castle), Coronation Street in Manchester and the Millennium Stadium in Cardiff.
We also analyse the data from our observing stations around the UK to provide a complete picture of where snow has fallen or was lying on Christmas Day.
How likely is a white Christmas?
We can accurately forecast if snow is likely on any given Christmas Day up to five days beforehand. In terms of the statistical likelihood of snow based on climatology, we know that a snowflake has fallen somewhere in the UK on Christmas Day 38 times in the last 54 years, so we can probably expect more than half of all Christmas Days to be a 'white Christmas'.
However, the Dickensian scene of widespread snow lying on the ground on Christmas Day is much rarer. There has only been a widespread covering of snow on the ground (where more than 40 % of stations in the UK reported snow on the ground at 9 am) four times in the last 51 years.


Toggle navigation
About
Contact
Log Out
Welcome to Bookend
Book Title:
Author:
Review:
Post Review
140
Your Favourites:


Primary Data Structure --- Pedigree
Contains studbook information for a number of individuals. ASSUME: All IDs listed in the sire or dam columns must have a row entry in the id column
getIncludeColumns
to get set of columns that can
be used in a pedigree file
A Pedigree is a data frame within the R
environment with the following
possible columns:
id -- character vector with unique identifier for an individual
sire -- character vector with unique identifier for an
individual's father (NA
if unknown).
dam -- character vector with unique identifier for an
individual's mother (NA
if unknown).
sex -- factor levels: "M", "F", "U" Sex specifier for an individual
gen -- integer vector with the generation number of the individual
birth -- Date or NA
(optional) with the individual's birth
date
exit -- Date or NA
(optional) with the individual's exit date
(death, or departure if applicable)
ancestry -- character vector or NA
(optional) that indicates
the geographic population to which the individual belongs.
age -- numeric or NA
(optional) indicating the individual's
current age or age at exit.
population -- logical (optional) Is the id part of the extant population?
origin -- character vector or NA
(optional) that indicates
the name of the facility that the individual was imported from if other than
local.NA
indicates the individual was not imported.
Pedigree File Testing Functions
qcStudbook --- Main pedigree curation function that performs basic quality control on pedigree information
fixColumnNames --- Changes original column names and into standardized names.
checkRequiredCols --- Examines column names, cols, to see if all required column names are present.
correctParentSex --- Sets sex for animals listed as either a sire or dam.
getDateErrorsAndConvertDatesInPed --- Converts columns of
dates in text form to Date
object columns
checkParentAge --- Check parent ages to be at least
minParentAge
removeDuplicates --- Remove duplicate records from pedigree
Gene Dropping Function
geneDrop --- Performs a gene drop simulation based on the provided pedigree information
Genetic Value Analysis Functions
Contains functions to calculate the kinship coefficient and genome uniqueness for animals listed in a Pedigree table.
meanKinship --- Calculates the mean kinship for each animal in a kinship matrix
calcA --- Calculates a
, the number of an individual's
alleles that are rare in each simulation.
alleleFreq --- Calculates the count of each allele in the provided vector.
calcFE --- Calculates founder equivalents.
calcFG --- Calculates founder genome equivalents.
calcFEFG--- Returns founder equivalents FE
and
FG
as elements in a list.
calcGU --- Calculates genome uniqueness for each ID that is part of the population.
geneDrop --- Performs a gene drop simulation based on the pedigree information.
chooseAlleles --- Combines two vectors of alleles by randomly selecting one allele or the other at each position.
calcRetention --- Calculates allelic retention.
filterKinMatrix --- Filters a kinship matrix to include only the egos listed in 'ids'
kinship --- Generates a kinship matrix
reportGV --- Generates a genetic value report for a provided pedigree.
Plotting Functions
meanKinship --- Calculates the mean kinship for each animal in a kinship matrix
Breeding Group Formation Functions
meanKinship --- Calculates the mean kinship for each animal in a kinship matrix


{% load i18n %}
{% blocktrans %} Hello, {% endblocktrans %}
{% blocktrans %} A transfer of project space has been initiated by {{ from_username }} to {{ to_username }}. If you believe this is an error, please contact us immediately at {{ support_email }} and follow this link to deactivate the transfer: {{ settings_url }} {% endblocktrans %}
{% blocktrans %} Thanks for using our site! {% endblocktrans %}
-The CommCare HQ team


FOR A FREE CAR INSURANCE RATE QUOTE THAT COULD SAVE YOU SUBSTANTIAL MONEY
WWW.GEICO.COMOR CALL 1-888-395-6349, 24 HOURS A DAY
If you have any comments about our WEB page, you can either write us at the address shown above or e-mail us at
<EMAIL_ADDRESS>due to the limited number of personnel in our corporate office, we are unable to provide a direct response.


File Timer.lua
Functions
| Timer:isElapsed () | Determine if time interval has elapsed. |
| Timer:new (t) | Constructor for new instance. |
| Timer:newClass (t) | Constructor for extending class. |
| Timer:nod () | Sleep for just a brief moment (.1 to 1 second), as specified by 'incr', typically in constructor. |
| Timer:start (interval) | Start timer |
Functions
- Timer:isElapsed ()
-
Determine if time interval has elapsed.
Usage:
really this needs to determine whether to wake up, whether time has elapsed or not (does not need to take shutdown into consideration, but does need to account for everything else).
do not call unless timer is known to have been started, and thus start-time and interval are defined.
- Timer:new (t)
-
Constructor for new instance.
Parameters:
-
t
:
-
- Timer:newClass (t)
-
Constructor for extending class.
Parameters:
-
t
:
-
- Timer:nod ()
- Sleep for just a brief moment (.1 to 1 second), as specified by 'incr', typically in constructor.
- Timer:start (interval)
-
Start timer
Parameters:
-
interval
: (number) must be specified either here or upon construction, or both.
-


Highlights
September 15, 2016
An Activity Stream is a list of recent activities performed by an individual, typically on a single website or a browser. Activity Stream for Firefox is a collection of all the things you do in the browser that you care about and visit often. Here, contents are shown with images based on your recent pages, screenshots, downloads, closing sessions, notifications, and improve your experience. This provides a great way to interact with the contents and pages the user has used over short period of time.
The Activity Stream will feature on the New Tab page and the Timeline page. This feature is now available as a Test Pilot add-on.
The Highlights (or Spotlights) is a feature in the Activity Stream which will display nearly now content (i.e., contents or pages accessed in the past 48 hours) in the form of tiles/blocks along with recommended content for the future. It is in form of tiles with a heading and a small description along with the duration(when it was last accessed). At maximum we will have three tiles where it’ll display recently visited pages or recently bookmarked pages or most visited pages or any trending topic from Pocket (an application and service for managing a reading list of articles from the Internet) or Facebook. After visiting the saved pocket link, a new link will be generated and displayed. Weighing on people’s browsing history and bookmarks, highlighted content is shown on the Activity Stream. This will achieve more relevant or useful history items on New Tab page.
An example for Highlights is shown in the above screenshot.
The above screenshot shows us how the Highlights is displayed on the New Tab page.
- To know how to install the Test Pilot and enable Activity Stream add-on, visit here.
- Check out the Timeline of Bookmarks feature in the Activity Stream.


Ricoh wants to make 360° video accessible with the Theta SC2
Round and round
by Chris KerrRicoh has announced a new easy-to-use, high-performance 360° camera called the Theta SC2 (£269). Designed with accessibility in mind, Ricoh claims the SC2 will help even the biggest technophobes shoot "incredibly realistic" 4K spherical video and capture impressive 360° images. To help everyone get to grips with the art of movie making, the 14MP handheld cam features a variety of preset modes, and comes with dedicated editing apps that can be used to apply the finishing touches to projects. Along with high-speed wireless transfers, the SC2 also facilitates direct uploads to social media incuding Facebook, Twitter, and Instagram, which will be music to the ears of any influencers out there.


favorite
Select your favorite sports
Cute Kitten 1
Cute Kitten 2
Cute Kitten 3
Cute Kitten 4
Cute Kitten 1
Cute Kitten 2
Cute Kitten 3
cloud
Next


This is the first slide which is going to be awesome.
This is the second slide which is not as awesome.
This is the most awesome slide of them all
IDO1
GITR
OX40
PD-1
JAK
PI3Kδ
PIM
FGFR
c-MET
BRD
LSD1


Blog Ported to Ruby on Rails
02/14/2019 2:25 PM MST
Ruby on Rails, blog, port
After doing some research for potential employment in Tucson, Arizona I encountered an employer who wanted Ruby on Rails knowledge. In order to fill this gap in my tech understanding, I decided to learn the framework and ended up enjoying using it (after some initial frustrations.) Once I realized the power of this framework, I decided to port my existing blog to it. I found a guide here which explained the basics of generating static site output from a Ruby on Rails website. I modified the example there and created a simple CMS whereby I can author and edit posts from the server end, and then run a rake task to generate the static HTML output.


{% extends 'layout.html' %} {% block body %}
This accordion content is copied from Refills, styled with Bitters/ Bourbon, and generated using RiotJS.


The love of my life and the most intriguing woman in the whole world is Alice Ava.
From the moment I saw her in a coffeehouse bar, I knew she completed me.