_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q237700 | Convert.save_ical | train | def save_ical(self, ical_location): # type: (str) -> None
""" Save the calendar instance to a file """
data = self.cal.to_ical()
with open(ical_location, 'w') as ical_file:
ical_file.write(data.decode('utf-8')) | python | {
"resource": ""
} |
q237701 | Convert.save_csv | train | def save_csv(self, csv_location): # type: (str) -> None
""" Save the csv to a file """
with open(csv_location, 'w') as csv_handle:
writer = csv.writer(csv_handle)
for row in self.csv_data:
writer.writerow(row) | python | {
"resource": ""
} |
q237702 | PlanetaryImage.open | train | def open(cls, filename):
""" Read an image file from disk
Parameters
----------
filename : string
Name of file to read as an image file. This file may be gzip
(``.gz``) or bzip2 (``.bz2``) compressed.
"""
if filename.endswith('.gz'):
... | python | {
"resource": ""
} |
q237703 | PlanetaryImage.image | train | def image(self):
"""An Image like array of ``self.data`` convenient for image processing tasks
* 2D array for single band, grayscale image data
* 3D array for three band, RGB image data
Enables working with ``self.data`` as if it were a PIL image.
See https://planetaryimage.re... | python | {
"resource": ""
} |
q237704 | CubeFile.apply_numpy_specials | train | def apply_numpy_specials(self, copy=True):
"""Convert isis special pixel values to numpy special pixel values.
======= =======
Isis Numpy
======= =======
Null nan
Lrs -inf
Lis -inf
His inf
... | python | {
"resource": ""
} |
q237705 | Pointer.parse | train | def parse(cls, value, record_bytes):
"""Parses the pointer label.
Parameters
----------
pointer_data
Supported values for `pointer_data` are::
^PTR = nnn
^PTR = nnn <BYTES>
^PTR = "filename"
^PTR = ("filename")... | python | {
"resource": ""
} |
q237706 | PDS3Image._save | train | def _save(self, file_to_write, overwrite):
"""Save PDS3Image object as PDS3 file.
Parameters
----------
filename: Set filename for the pds image to be saved.
Overwrite: Use this keyword to save image with same filename.
Usage: image.save('temp.IMG', overwrite=True)
... | python | {
"resource": ""
} |
q237707 | PDS3Image._create_label | train | def _create_label(self, array):
"""Create sample PDS3 label for NumPy Array.
It is called by 'image.py' to create PDS3Image object
from Numpy Array.
Returns
-------
PVLModule label for the given NumPy array.
Usage: self.label = _create_label(array)
"""
... | python | {
"resource": ""
} |
q237708 | PDS3Image._update_label | train | def _update_label(self, label, array):
"""Update PDS3 label for NumPy Array.
It is called by '_create_label' to update label values
such as,
- ^IMAGE, RECORD_BYTES
- STANDARD_DEVIATION
- MAXIMUM, MINIMUM
- MEDIAN, MEAN
Returns
-------
Upda... | python | {
"resource": ""
} |
q237709 | iv | train | def iv(base, counter):
"""Generate an initialization vector.
"""
if (counter >> 64) != 0:
raise ECEException(u"Counter too big")
(mask,) = struct.unpack("!Q", base[4:])
return base[:4] + struct.pack("!Q", counter ^ mask) | python | {
"resource": ""
} |
q237710 | encrypt | train | def encrypt(content, salt=None, key=None,
private_key=None, dh=None, auth_secret=None,
keyid=None, keylabel="P-256",
rs=4096, version="aes128gcm"):
"""
Encrypt a data block
:param content: block of data to encrypt
:type content: str
:param salt: Encryption salt
... | python | {
"resource": ""
} |
q237711 | VarlinkError.parameters | train | def parameters(self, namespaced=False):
"""returns the exception varlink error parameters"""
if namespaced:
return json.loads(json.dumps(self.args[0]['parameters']), object_hook=lambda d: SimpleNamespace(**d))
else:
return self.args[0].get('parameters') | python | {
"resource": ""
} |
q237712 | Service.handle | train | def handle(self, message, _server=None, _request=None):
"""This generator function handles any incoming message.
Write any returned bytes to the output stream.
>>> for outgoing_message in service.handle(incoming_message):
>>> connection.write(outgoing_message)
"""
... | python | {
"resource": ""
} |
q237713 | Server.server_close | train | def server_close(self):
"""Called to clean-up the server.
May be overridden.
"""
if self.remove_file:
try:
os.remove(self.remove_file)
except:
pass
self.socket.close() | python | {
"resource": ""
} |
q237714 | Client.open | train | def open(self, interface_name, namespaced=False, connection=None):
"""Open a new connection and get a client interface handle with the varlink methods installed.
:param interface_name: an interface name, which the service this client object is
connected to, provides.
... | python | {
"resource": ""
} |
q237715 | Client.get_interfaces | train | def get_interfaces(self, socket_connection=None):
"""Returns the a list of Interface objects the service implements."""
if not socket_connection:
socket_connection = self.open_connection()
close_socket = True
else:
close_socket = False
# noinspection ... | python | {
"resource": ""
} |
q237716 | Client.add_interface | train | def add_interface(self, interface):
"""Manually add or overwrite an interface definition from an Interface object.
:param interface: an Interface() object
"""
if not isinstance(interface, Interface):
raise TypeError
self._interfaces[interface.name] = interface | python | {
"resource": ""
} |
q237717 | create | train | def create(atoms_list,N, L, cutoff = 0, all_atomtypes=[]):
"""Takes a trajectory xyz file and writes soap features
"""
myAlphas, myBetas = genBasis.getBasisFunc(cutoff, N)
# get information about feature length
n_datapoints = len(atoms_list)
atoms = atoms_list[0]
x = get_lastatom_soap(atoms,... | python | {
"resource": ""
} |
q237718 | getPoly | train | def getPoly(rCut, nMax):
"""Used to calculate discrete vectors for the polynomial basis functions.
Args:
rCut(float): Radial cutoff
nMax(int): Number of polynomial radial functions
"""
rCutVeryHard = rCut+5.0
rx = 0.5*rCutVeryHard*(x + 1)
basisFunctions = []
for i in range(... | python | {
"resource": ""
} |
q237719 | _format_ase2clusgeo | train | def _format_ase2clusgeo(obj, all_atomtypes=None):
""" Takes an ase Atoms object and returns numpy arrays and integers
which are read by the internal clusgeo. Apos is currently a flattened
out numpy array
Args:
obj():
all_atomtypes():
sort():
"""
#atoms metadata
total... | python | {
"resource": ""
} |
q237720 | get_soap_structure | train | def get_soap_structure(obj, alp, bet, rCut=5.0, nMax=5, Lmax=5, crossOver=True, all_atomtypes=None, eta=1.0):
"""Get the RBF basis SOAP output for atoms in a finite structure.
Args:
obj(ase.Atoms): Atomic structure for which the SOAP output is
calculated.
alp: Alphas
bet: Be... | python | {
"resource": ""
} |
q237721 | get_periodic_soap_locals | train | def get_periodic_soap_locals(obj, Hpos, alp, bet, rCut=5.0, nMax=5, Lmax=5, crossOver=True, all_atomtypes=None, eta=1.0):
"""Get the RBF basis SOAP output for the given position in a periodic system.
Args:
obj(ase.Atoms): Atomic structure for which the SOAP output is
calculated.
alp... | python | {
"resource": ""
} |
q237722 | Orbit.orbit_gen | train | def orbit_gen(self):
"""
Generator for iterating over each orbit.
"""
if self.norbits == 1:
yield self
else:
for i in range(self.norbits):
yield self[:, i] | python | {
"resource": ""
} |
q237723 | Orbit.zmax | train | def zmax(self, return_times=False, func=np.mean,
interp_kwargs=None, minimize_kwargs=None,
approximate=False):
"""
Estimate the maximum ``z`` height of the orbit by identifying local
maxima in the absolute value of the ``z`` position and interpolating
between ti... | python | {
"resource": ""
} |
q237724 | Orbit.eccentricity | train | def eccentricity(self, **kw):
r"""
Returns the eccentricity computed from the mean apocenter and
mean pericenter.
.. math::
e = \frac{r_{\rm apo} - r_{\rm per}}{r_{\rm apo} + r_{\rm per}}
Parameters
----------
**kw
Any keyword arguments ... | python | {
"resource": ""
} |
q237725 | Orbit.estimate_period | train | def estimate_period(self, radial=True):
"""
Estimate the period of the orbit. By default, computes the radial
period. If ``radial==False``, this returns period estimates for
each dimension of the orbit.
Parameters
----------
radial : bool (optional)
W... | python | {
"resource": ""
} |
q237726 | Orbit.circulation | train | def circulation(self):
"""
Determine which axes the Orbit circulates around by checking
whether there is a change of sign of the angular momentum
about an axis. Returns a 2D array with ``ndim`` integers per orbit
point. If a box orbit, all integers will be 0. A 1 indicates
... | python | {
"resource": ""
} |
q237727 | Orbit.align_circulation_with_z | train | def align_circulation_with_z(self, circulation=None):
"""
If the input orbit is a tube orbit, this function aligns the circulation
axis with the z axis and returns a copy.
Parameters
----------
circulation : array_like (optional)
Array of bits that specify th... | python | {
"resource": ""
} |
q237728 | greatcircle_to_greatcircle | train | def greatcircle_to_greatcircle(from_greatcircle_coord,
to_greatcircle_frame):
"""Transform between two greatcircle frames."""
# This transform goes through the parent frames on each side.
# from_frame -> from_frame.origin -> to_frame.origin -> to_frame
intermediate_from =... | python | {
"resource": ""
} |
q237729 | reference_to_greatcircle | train | def reference_to_greatcircle(reference_frame, greatcircle_frame):
"""Convert a reference coordinate to a great circle frame."""
# Define rotation matrices along the position angle vector, and
# relative to the origin.
pole = greatcircle_frame.pole.transform_to(coord.ICRS)
ra0 = greatcircle_frame.ra... | python | {
"resource": ""
} |
q237730 | pole_from_endpoints | train | def pole_from_endpoints(coord1, coord2):
"""Compute the pole from a great circle that connects the two specified
coordinates.
This assumes a right-handed rule from coord1 to coord2: the pole is the
north pole under that assumption.
Parameters
----------
coord1 : `~astropy.coordinates.SkyCo... | python | {
"resource": ""
} |
q237731 | sph_midpoint | train | def sph_midpoint(coord1, coord2):
"""Compute the midpoint between two points on the sphere.
Parameters
----------
coord1 : `~astropy.coordinates.SkyCoord`
Coordinate of one point on a great circle.
coord2 : `~astropy.coordinates.SkyCoord`
Coordinate of the other point on a great cir... | python | {
"resource": ""
} |
q237732 | get_uv_tan | train | def get_uv_tan(c):
"""Get tangent plane basis vectors on the unit sphere at the given
spherical coordinates.
"""
l = c.spherical.lon
b = c.spherical.lat
p = np.array([-np.sin(l), np.cos(l), np.zeros_like(l.value)]).T
q = np.array([-np.cos(l)*np.sin(b), -np.sin(l)*np.sin(b), np.cos(b)]).T
... | python | {
"resource": ""
} |
q237733 | transform_pm_cov | train | def transform_pm_cov(c, cov, to_frame):
"""Transform a proper motion covariance matrix to a new frame.
Parameters
----------
c : `~astropy.coordinates.SkyCoord`
The sky coordinates of the sources in the initial coordinate frame.
cov : array_like
The covariance matrix of the proper m... | python | {
"resource": ""
} |
q237734 | rodrigues_axis_angle_rotate | train | def rodrigues_axis_angle_rotate(x, vec, theta):
"""
Rotated the input vector or set of vectors `x` around the axis
`vec` by the angle `theta`.
Parameters
----------
x : array_like
The vector or array of vectors to transform. Must have shape
"""
x = np.array(x).T
vec = np.a... | python | {
"resource": ""
} |
q237735 | z_angle_rotate | train | def z_angle_rotate(xy, theta):
"""
Rotated the input vector or set of vectors `xy` by the angle `theta`.
Parameters
----------
xy : array_like
The vector or array of vectors to transform. Must have shape
"""
xy = np.array(xy).T
theta = np.array(theta).T
out = np.zeros_lik... | python | {
"resource": ""
} |
q237736 | static_to_constantrotating | train | def static_to_constantrotating(frame_i, frame_r, w, t=None):
"""
Transform from an inertial static frame to a rotating frame.
Parameters
----------
frame_i : `~gala.potential.StaticFrame`
frame_r : `~gala.potential.ConstantRotatingFrame`
w : `~gala.dynamics.PhaseSpacePosition`, `~gala.dynam... | python | {
"resource": ""
} |
q237737 | constantrotating_to_static | train | def constantrotating_to_static(frame_r, frame_i, w, t=None):
"""
Transform from a constantly rotating frame to a static, inertial frame.
Parameters
----------
frame_i : `~gala.potential.StaticFrame`
frame_r : `~gala.potential.ConstantRotatingFrame`
w : `~gala.dynamics.PhaseSpacePosition`, `... | python | {
"resource": ""
} |
q237738 | to_dict | train | def to_dict(potential):
"""
Turn a potential object into a dictionary that fully specifies the
state of the object.
Parameters
----------
potential : :class:`~gala.potential.PotentialBase`
The instantiated :class:`~gala.potential.PotentialBase` object.
"""
from .. import potent... | python | {
"resource": ""
} |
q237739 | Integrator._prepare_ws | train | def _prepare_ws(self, w0, mmap, n_steps):
"""
Decide how to make the return array. If mmap is False, this returns a
full array of zeros, but with the correct shape as the output. If mmap
is True, return a pointer to a memory-mapped array. The latter is
particularly useful for int... | python | {
"resource": ""
} |
q237740 | fast_lyapunov_max | train | def fast_lyapunov_max(w0, hamiltonian, dt, n_steps, d0=1e-5,
n_steps_per_pullback=10, noffset_orbits=2, t1=0.,
atol=1E-10, rtol=1E-10, nmax=0, return_orbit=True):
"""
Compute the maximum Lyapunov exponent using a C-implemented estimator
that uses the DOPRI853 inte... | python | {
"resource": ""
} |
q237741 | surface_of_section | train | def surface_of_section(orbit, plane_ix, interpolate=False):
"""
Generate and return a surface of section from the given orbit.
.. warning::
This is an experimental function and the API may change.
Parameters
----------
orbit : `~gala.dynamics.Orbit`
plane_ix : int
Integer ... | python | {
"resource": ""
} |
q237742 | PotentialBase._remove_units | train | def _remove_units(self, x):
"""
Always returns an array. If a Quantity is passed in, it converts to the
units associated with this object and returns the value.
"""
if hasattr(x, 'unit'):
x = x.decompose(self.units).value
else:
x = np.array(x)
... | python | {
"resource": ""
} |
q237743 | PotentialBase.mass_enclosed | train | def mass_enclosed(self, q, t=0.):
"""
Estimate the mass enclosed within the given position by assuming the potential
is spherical.
Parameters
----------
q : `~gala.dynamics.PhaseSpacePosition`, `~astropy.units.Quantity`, array_like
Position(s) to estimate the... | python | {
"resource": ""
} |
q237744 | PotentialBase.circular_velocity | train | def circular_velocity(self, q, t=0.):
"""
Estimate the circular velocity at the given position assuming the
potential is spherical.
Parameters
----------
q : array_like, numeric
Position(s) to estimate the circular velocity.
Returns
-------
... | python | {
"resource": ""
} |
q237745 | format_doc | train | def format_doc(*args, **kwargs):
"""
Replaces the docstring of the decorated object and then formats it.
Modeled after astropy.utils.decorators.format_doc
"""
def set_docstring(obj):
# None means: use the objects __doc__
doc = obj.__doc__
# Delete documentation in this case... | python | {
"resource": ""
} |
q237746 | quantity_to_hdf5 | train | def quantity_to_hdf5(f, key, q):
"""
Turn an Astropy Quantity object into something we can write out to
an HDF5 file.
Parameters
----------
f : :class:`h5py.File`, :class:`h5py.Group`, :class:`h5py.DataSet`
key : str
The name.
q : float, `astropy.units.Quantity`
The quan... | python | {
"resource": ""
} |
q237747 | UnitSystem.get_constant | train | def get_constant(self, name):
"""
Retrieve a constant with specified name in this unit system.
Parameters
----------
name : str
The name of the constant, e.g., G.
Returns
-------
const : float
The value of the constant represented... | python | {
"resource": ""
} |
q237748 | atleast_2d | train | def atleast_2d(*arys, **kwargs):
"""
View inputs as arrays with at least two dimensions.
Parameters
----------
arys1, arys2, ... : array_like
One or more array-like sequences. Non-array inputs are converted
to arrays. Arrays that already have two or more dimensions are
pre... | python | {
"resource": ""
} |
q237749 | Quaternion.from_v_theta | train | def from_v_theta(cls, v, theta):
"""
Create a quaternion from unit vector v and rotation angle theta.
Returns
-------
q : :class:`gala.coordinates.Quaternion`
A ``Quaternion`` instance.
"""
theta = np.asarray(theta)
v = np.asarray(v)
... | python | {
"resource": ""
} |
q237750 | Quaternion.random | train | def random(cls):
"""
Randomly sample a Quaternion from a distribution uniform in
3D rotation angles.
https://www-preview.ri.cmu.edu/pub_files/pub4/kuffner_james_2004_1/kuffner_james_2004_1.pdf
Returns
-------
q : :class:`gala.coordinates.Quaternion`
... | python | {
"resource": ""
} |
q237751 | LeapfrogIntegrator.step | train | def step(self, t, x_im1, v_im1_2, dt):
"""
Step forward the positions and velocities by the given timestep.
Parameters
----------
dt : numeric
The timestep to move forward.
"""
x_i = x_im1 + v_im1_2 * dt
F_i = self.F(t, np.vstack((x_i, v_im1_... | python | {
"resource": ""
} |
q237752 | fit_isochrone | train | def fit_isochrone(orbit, m0=2E11, b0=1., minimize_kwargs=None):
r"""
Fit the toy Isochrone potential to the sum of the energy residuals relative
to the mean energy by minimizing the function
.. math::
f(m,b) = \sum_i (\frac{1}{2}v_i^2 + \Phi_{\rm iso}(x_i\,|\,m,b) - <E>)^2
TODO: This shou... | python | {
"resource": ""
} |
q237753 | fit_harmonic_oscillator | train | def fit_harmonic_oscillator(orbit, omega0=[1., 1, 1], minimize_kwargs=None):
r"""
Fit the toy harmonic oscillator potential to the sum of the energy
residuals relative to the mean energy by minimizing the function
.. math::
f(\boldsymbol{\omega}) = \sum_i (\frac{1}{2}v_i^2 + \Phi_{\rm sho}(x_i... | python | {
"resource": ""
} |
q237754 | check_angle_sampling | train | def check_angle_sampling(nvecs, angles):
"""
Returns a list of the index of elements of n which do not have adequate
toy angle coverage. The criterion is that we must have at least one sample
in each Nyquist box when we project the toy angles along the vector n.
Parameters
----------
nvecs ... | python | {
"resource": ""
} |
q237755 | find_actions | train | def find_actions(orbit, N_max, force_harmonic_oscillator=False, toy_potential=None):
r"""
Find approximate actions and angles for samples of a phase-space orbit.
Uses toy potentials with known, analytic action-angle transformations to
approximate the true coordinates as a Fourier sum.
This code is ... | python | {
"resource": ""
} |
q237756 | angact_ho | train | def angact_ho(x,omega):
""" Calculate angle and action variable in sho potential with
parameter omega """
action = (x[3:]**2+(omega*x[:3])**2)/(2.*omega)
angle = np.array([np.arctan(-x[3+i]/omega[i]/x[i]) if x[i]!=0. else -np.sign(x[3+i])*np.pi/2. for i in range(3)])
for i in range(3):
if(x[... | python | {
"resource": ""
} |
q237757 | peak_to_peak_period | train | def peak_to_peak_period(t, f, amplitude_threshold=1E-2):
"""
Estimate the period of the input time series by measuring the average
peak-to-peak time.
Parameters
----------
t : array_like
Time grid aligned with the input time series.
f : array_like
A periodic time series.
... | python | {
"resource": ""
} |
q237758 | estimate_dt_n_steps | train | def estimate_dt_n_steps(w0, hamiltonian, n_periods, n_steps_per_period,
dE_threshold=1E-9, func=np.nanmax,
**integrate_kwargs):
"""
Estimate the timestep and number of steps to integrate an orbit for
given its initial conditions and a potential object.
Pa... | python | {
"resource": ""
} |
q237759 | reflex_correct | train | def reflex_correct(coords, galactocentric_frame=None):
"""Correct the input Astropy coordinate object for solar reflex motion.
The input coordinate instance must have distance and radial velocity information. If the radial velocity is not known, fill the
Parameters
----------
coords : `~astropy.co... | python | {
"resource": ""
} |
q237760 | plot_projections | train | def plot_projections(x, relative_to=None, autolim=True, axes=None,
subplots_kwargs=dict(), labels=None, plot_function=None,
**kwargs):
"""
Given N-dimensional quantity, ``x``, make a figure containing 2D projections
of all combinations of the axes.
Parameters
... | python | {
"resource": ""
} |
q237761 | angmom | train | def angmom(x):
""" returns angular momentum vector of phase-space point x"""
return np.array([x[1]*x[5]-x[2]*x[4],x[2]*x[3]-x[0]*x[5],x[0]*x[4]-x[1]*x[3]]) | python | {
"resource": ""
} |
q237762 | flip_coords | train | def flip_coords(X,loop):
""" Align circulation with z-axis """
if(loop[0]==1):
return np.array(map(lambda i: np.array([i[2],i[1],i[0],i[5],i[4],i[3]]),X))
else:
return X | python | {
"resource": ""
} |
q237763 | harmonic_oscillator_to_aa | train | def harmonic_oscillator_to_aa(w, potential):
"""
Transform the input cartesian position and velocity to action-angle
coordinates for the Harmonic Oscillator potential.
This transformation is analytic and can be used as a "toy potential"
in the Sanders & Binney (2014) formalism for computing action-... | python | {
"resource": ""
} |
q237764 | RK5Integrator.step | train | def step(self, t, w, dt):
""" Step forward the vector w by the given timestep.
Parameters
----------
dt : numeric
The timestep to move forward.
"""
# Runge-Kutta Fehlberg formulas (see: Numerical Recipes)
F = lambda t, w: self.F(t, w,... | python | {
"resource": ""
} |
q237765 | check_each_direction | train | def check_each_direction(n,angs,ifprint=True):
""" returns a list of the index of elements of n which do not have adequate
toy angle coverage. The criterion is that we must have at least one sample
in each Nyquist box when we project the toy angles along the vector n """
checks = np.array([])
P = np... | python | {
"resource": ""
} |
q237766 | unroll_angles | train | def unroll_angles(A,sign):
""" Unrolls the angles, A, so they increase continuously """
n = np.array([0,0,0])
P = np.zeros(np.shape(A))
P[0]=A[0]
for i in range(1,len(A)):
n = n+((A[i]-A[i-1]+0.5*sign*np.pi)*sign<0)*np.ones(3)*2.*np.pi
P[i] = A[i]+sign*n
return P | python | {
"resource": ""
} |
q237767 | compute_coeffs | train | def compute_coeffs(density_func, nmax, lmax, M, r_s, args=(),
skip_odd=False, skip_even=False, skip_m=False,
S_only=False, progress=False, **nquad_opts):
"""
Compute the expansion coefficients for representing the input density function using a basis
function expansion.... | python | {
"resource": ""
} |
q237768 | compute_coeffs_discrete | train | def compute_coeffs_discrete(xyz, mass, nmax, lmax, r_s,
skip_odd=False, skip_even=False, skip_m=False,
compute_var=False):
"""
Compute the expansion coefficients for representing the density distribution of input points
as a basis function expansion. T... | python | {
"resource": ""
} |
q237769 | DirectNBody.integrate_orbit | train | def integrate_orbit(self, **time_spec):
"""
Integrate the initial conditions in the combined external potential
plus N-body forces.
This integration uses the `~gala.integrate.DOPRI853Integrator`.
Parameters
----------
**time_spec
Specification of how... | python | {
"resource": ""
} |
q237770 | NDMixin._apply | train | def _apply(self, method, *args, **kwargs):
"""Create a new representation with ``method`` applied to the arrays.
In typical usage, the method is any of the shape-changing methods for
`~numpy.ndarray` (``reshape``, ``swapaxes``, etc.), as well as those
picking particular elements (``__ge... | python | {
"resource": ""
} |
q237771 | NDCartesianRepresentation.get_xyz | train | def get_xyz(self, xyz_axis=0):
"""Return a vector array of the x, y, and z coordinates.
Parameters
----------
xyz_axis : int, optional
The axis in the final array along which the x, y, z components
should be stored (default: 0).
Returns
-------
... | python | {
"resource": ""
} |
q237772 | CommonBase._get_c_valid_arr | train | def _get_c_valid_arr(self, x):
"""
Warning! Interpretation of axes is different for C code.
"""
orig_shape = x.shape
x = np.ascontiguousarray(x.reshape(orig_shape[0], -1).T)
return orig_shape, x | python | {
"resource": ""
} |
q237773 | CommonBase._validate_prepare_time | train | def _validate_prepare_time(self, t, pos_c):
"""
Make sure that t is a 1D array and compatible with the C position array.
"""
if hasattr(t, 'unit'):
t = t.decompose(self.units).value
if not isiterable(t):
t = np.atleast_1d(t)
t = np.ascontiguousar... | python | {
"resource": ""
} |
q237774 | PhaseSpacePosition.get_components | train | def get_components(self, which):
"""
Get the component name dictionary for the desired object.
The returned dictionary maps component names on this class to component
names on the desired object.
Parameters
----------
which : str
Can either be ``'pos... | python | {
"resource": ""
} |
q237775 | PhaseSpacePosition.to_frame | train | def to_frame(self, frame, current_frame=None, **kwargs):
"""
Transform to a new reference frame.
Parameters
----------
frame : `~gala.potential.FrameBase`
The frame to transform to.
current_frame : `gala.potential.CFrameBase`
The current frame the... | python | {
"resource": ""
} |
q237776 | PhaseSpacePosition.to_coord_frame | train | def to_coord_frame(self, frame, galactocentric_frame=None, **kwargs):
"""
Transform the orbit from Galactocentric, cartesian coordinates to
Heliocentric coordinates in the specified Astropy coordinate frame.
Parameters
----------
frame : :class:`~astropy.coordinates.Base... | python | {
"resource": ""
} |
q237777 | PhaseSpacePosition._plot_prepare | train | def _plot_prepare(self, components, units):
"""
Prepare the ``PhaseSpacePosition`` or subclass for passing to a plotting
routine to plot all projections of the object.
"""
# components to plot
if components is None:
components = self.pos.components
n_... | python | {
"resource": ""
} |
q237778 | HSClient.get_account_info | train | def get_account_info(self):
''' Get current account information
The information then will be saved in `self.account` so that you can
access the information like this:
>>> hsclient = HSClient()
>>> acct = hsclient.get_account_info()
>>> print acct.email_address
... | python | {
"resource": ""
} |
q237779 | HSClient.update_account_info | train | def update_account_info(self):
''' Update current account information
At the moment you can only update your callback_url.
Returns:
An Account object
'''
request = self._get_request()
return request.post(self.ACCOUNT_UPDATE_URL, {
'callback_url'... | python | {
"resource": ""
} |
q237780 | HSClient.verify_account | train | def verify_account(self, email_address):
''' Verify whether a HelloSign Account exists
Args:
email_address (str): Email address for the account to verify
Returns:
True or False
'''
request = self._get_request()
resp = request.pos... | python | {
"resource": ""
} |
q237781 | HSClient.get_signature_request | train | def get_signature_request(self, signature_request_id, ux_version=None):
''' Get a signature request by its ID
Args:
signature_request_id (str): The id of the SignatureRequest to retrieve
ux_version (int): UX version, either 1 (default) or 2.
Returns:... | python | {
"resource": ""
} |
q237782 | HSClient.get_signature_request_list | train | def get_signature_request_list(self, page=1, ux_version=None):
''' Get a list of SignatureRequest that you can access
This includes SignatureRequests you have sent as well as received, but
not ones that you have been CCed on.
Args:
page (int, optional): Which page number... | python | {
"resource": ""
} |
q237783 | HSClient.get_signature_request_file | train | def get_signature_request_file(self, signature_request_id, path_or_file=None, file_type=None, filename=None):
''' Download the PDF copy of the current documents
Args:
signature_request_id (str): Id of the signature request
path_or_file (str or file): A writable File-like objec... | python | {
"resource": ""
} |
q237784 | HSClient.send_signature_request | train | def send_signature_request(self, test_mode=False, files=None, file_urls=None, title=None, subject=None, message=None, signing_redirect_url=None, signers=None, cc_email_addresses=None, form_fields_per_document=None, use_text_tags=False, hide_text_tags=False, metadata=None, ux_version=None, allow_decline=False):
... | python | {
"resource": ""
} |
q237785 | HSClient.send_signature_request_with_template | train | def send_signature_request_with_template(self, test_mode=False, template_id=None, template_ids=None, title=None, subject=None, message=None, signing_redirect_url=None, signers=None, ccs=None, custom_fields=None, metadata=None, ux_version=None, allow_decline=False):
''' Creates and sends a new SignatureRequest b... | python | {
"resource": ""
} |
q237786 | HSClient.remind_signature_request | train | def remind_signature_request(self, signature_request_id, email_address):
''' Sends an email to the signer reminding them to sign the signature request
Sends an email to the signer reminding them to sign the signature
request. You cannot send a reminder within 1 hours of the last reminder
... | python | {
"resource": ""
} |
q237787 | HSClient.cancel_signature_request | train | def cancel_signature_request(self, signature_request_id):
''' Cancels a SignatureRequest
Cancels a SignatureRequest. After canceling, no one will be able to sign
or access the SignatureRequest or its documents. Only the requester can
cancel and only before everyone has signed.
... | python | {
"resource": ""
} |
q237788 | HSClient.get_template | train | def get_template(self, template_id):
''' Gets a Template which includes a list of Accounts that can access it
Args:
template_id (str): The id of the template to retrieve
Returns:
A Template object
'''
request = self._get_request()
return reques... | python | {
"resource": ""
} |
q237789 | HSClient.get_template_list | train | def get_template_list(self, page=1, page_size=None, account_id=None, query=None):
''' Lists your Templates
Args:
page (int, optional): Page number of the template List to return. Defaults to 1.
page_size (int, optional): Number of objects to be returned per page,... | python | {
"resource": ""
} |
q237790 | HSClient.add_user_to_template | train | def add_user_to_template(self, template_id, account_id=None, email_address=None):
''' Gives the specified Account access to the specified Template
Args:
template_id (str): The id of the template to give the account access to
account_id (str): The id of the account t... | python | {
"resource": ""
} |
q237791 | HSClient.remove_user_from_template | train | def remove_user_from_template(self, template_id, account_id=None, email_address=None):
''' Removes the specified Account's access to the specified Template
Args:
template_id (str): The id of the template to remove the account's access from.
account_id (str): The id ... | python | {
"resource": ""
} |
q237792 | HSClient.delete_template | train | def delete_template(self, template_id):
''' Deletes the specified template
Args:
template_id (str): The id of the template to delete
Returns:
A status code
'''
url = self.TEMPLATE_DELETE_URL
request = self._get_request()
response = re... | python | {
"resource": ""
} |
q237793 | HSClient.get_template_files | train | def get_template_files(self, template_id, filename):
''' Download a PDF copy of a template's original files
Args:
template_id (str): The id of the template to retrieve.
filename (str): Filename to save the PDF file to. This should be a full path.
Returns:
... | python | {
"resource": ""
} |
q237794 | HSClient.create_embedded_template_draft | train | def create_embedded_template_draft(self, client_id, signer_roles, test_mode=False, files=None, file_urls=None, title=None, subject=None, message=None, cc_roles=None, merge_fields=None, use_preexisting_fields=False):
''' Creates an embedded Template draft for further editing.
Args:
test_mod... | python | {
"resource": ""
} |
q237795 | HSClient.create_team | train | def create_team(self, name):
''' Creates a new Team
Creates a new Team and makes you a member. You must not currently belong to a team to invoke.
Args:
name (str): The name of your team
Returns:
A Team object
'''
request = self._get_request()
... | python | {
"resource": ""
} |
q237796 | HSClient.update_team_name | train | def update_team_name(self, name):
''' Updates a Team's name
Args:
name (str): The new name of your team
Returns:
A Team object
'''
request = self._get_request()
return request.post(self.TEAM_UPDATE_URL, {"name": name}) | python | {
"resource": ""
} |
q237797 | HSClient.destroy_team | train | def destroy_team(self):
''' Delete your Team
Deletes your Team. Can only be invoked when you have a team with only one member left (yourself).
Returns:
None
'''
request = self._get_request()
request.post(url=self.TEAM_DESTROY_URL, get_json=False) | python | {
"resource": ""
} |
q237798 | HSClient.add_team_member | train | def add_team_member(self, account_id=None, email_address=None):
''' Add or invite a user to your Team
Args:
account_id (str): The id of the account of the user to invite to your team.
email_address (str): The email address of the account to invite to your team. The ac... | python | {
"resource": ""
} |
q237799 | HSClient.remove_team_member | train | def remove_team_member(self, account_id=None, email_address=None):
''' Remove a user from your Team
Args:
account_id (str): The id of the account of the user to remove from your team.
email_address (str): The email address of the account to remove from your team. The ... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.