repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
listlengths
20
707
docstring
stringlengths
3
17.3k
docstring_tokens
listlengths
3
222
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
idx
int64
0
252k
pkgw/pwkit
pwkit/fk10.py
Calculator.set_bfield
def set_bfield(self, B_G): """Set the strength of the local magnetic field. **Call signature** *B_G* The magnetic field strength, in Gauss Returns *self* for convenience in chaining. """ if not (B_G > 0): raise ValueError('must have B_G >...
python
def set_bfield(self, B_G): """Set the strength of the local magnetic field. **Call signature** *B_G* The magnetic field strength, in Gauss Returns *self* for convenience in chaining. """ if not (B_G > 0): raise ValueError('must have B_G >...
[ "def", "set_bfield", "(", "self", ",", "B_G", ")", ":", "if", "not", "(", "B_G", ">", "0", ")", ":", "raise", "ValueError", "(", "'must have B_G > 0; got %r'", "%", "(", "B_G", ",", ")", ")", "self", ".", "in_vals", "[", "IN_VAL_B", "]", "=", "B_G", ...
Set the strength of the local magnetic field. **Call signature** *B_G* The magnetic field strength, in Gauss Returns *self* for convenience in chaining.
[ "Set", "the", "strength", "of", "the", "local", "magnetic", "field", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/fk10.py#L364-L378
train
62,300
pkgw/pwkit
pwkit/fk10.py
Calculator.set_bfield_for_s0
def set_bfield_for_s0(self, s0): """Set B to probe a certain harmonic number. **Call signature** *s0* The harmonic number to probe at the lowest frequency Returns *self* for convenience in chaining. This just proceeds from the relation ``nu = s nu_c = s e B...
python
def set_bfield_for_s0(self, s0): """Set B to probe a certain harmonic number. **Call signature** *s0* The harmonic number to probe at the lowest frequency Returns *self* for convenience in chaining. This just proceeds from the relation ``nu = s nu_c = s e B...
[ "def", "set_bfield_for_s0", "(", "self", ",", "s0", ")", ":", "if", "not", "(", "s0", ">", "0", ")", ":", "raise", "ValueError", "(", "'must have s0 > 0; got %r'", "%", "(", "s0", ",", ")", ")", "B0", "=", "2", "*", "np", ".", "pi", "*", "cgs", "...
Set B to probe a certain harmonic number. **Call signature** *s0* The harmonic number to probe at the lowest frequency Returns *self* for convenience in chaining. This just proceeds from the relation ``nu = s nu_c = s e B / 2 pi m_e c``. Since *s* and *nu* ...
[ "Set", "B", "to", "probe", "a", "certain", "harmonic", "number", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/fk10.py#L381-L402
train
62,301
pkgw/pwkit
pwkit/fk10.py
Calculator.set_edist_powerlaw
def set_edist_powerlaw(self, emin_mev, emax_mev, delta, ne_cc): """Set the energy distribution function to a power law. **Call signature** *emin_mev* The minimum energy of the distribution, in MeV *emax_mev* The maximum energy of the distribution, in MeV *de...
python
def set_edist_powerlaw(self, emin_mev, emax_mev, delta, ne_cc): """Set the energy distribution function to a power law. **Call signature** *emin_mev* The minimum energy of the distribution, in MeV *emax_mev* The maximum energy of the distribution, in MeV *de...
[ "def", "set_edist_powerlaw", "(", "self", ",", "emin_mev", ",", "emax_mev", ",", "delta", ",", "ne_cc", ")", ":", "if", "not", "(", "emin_mev", ">=", "0", ")", ":", "raise", "ValueError", "(", "'must have emin_mev >= 0; got %r'", "%", "(", "emin_mev", ",", ...
Set the energy distribution function to a power law. **Call signature** *emin_mev* The minimum energy of the distribution, in MeV *emax_mev* The maximum energy of the distribution, in MeV *delta* The power-law index of the distribution *ne_cc* ...
[ "Set", "the", "energy", "distribution", "function", "to", "a", "power", "law", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/fk10.py#L405-L435
train
62,302
pkgw/pwkit
pwkit/fk10.py
Calculator.set_edist_powerlaw_gamma
def set_edist_powerlaw_gamma(self, gmin, gmax, delta, ne_cc): """Set the energy distribution function to a power law in the Lorentz factor **Call signature** *gmin* The minimum Lorentz factor of the distribution *gmax* The maximum Lorentz factor of the distribution ...
python
def set_edist_powerlaw_gamma(self, gmin, gmax, delta, ne_cc): """Set the energy distribution function to a power law in the Lorentz factor **Call signature** *gmin* The minimum Lorentz factor of the distribution *gmax* The maximum Lorentz factor of the distribution ...
[ "def", "set_edist_powerlaw_gamma", "(", "self", ",", "gmin", ",", "gmax", ",", "delta", ",", "ne_cc", ")", ":", "if", "not", "(", "gmin", ">=", "1", ")", ":", "raise", "ValueError", "(", "'must have gmin >= 1; got %r'", "%", "(", "gmin", ",", ")", ")", ...
Set the energy distribution function to a power law in the Lorentz factor **Call signature** *gmin* The minimum Lorentz factor of the distribution *gmax* The maximum Lorentz factor of the distribution *delta* The power-law index of the distribution ...
[ "Set", "the", "energy", "distribution", "function", "to", "a", "power", "law", "in", "the", "Lorentz", "factor" ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/fk10.py#L438-L468
train
62,303
pkgw/pwkit
pwkit/fk10.py
Calculator.set_freqs
def set_freqs(self, n, f_lo_ghz, f_hi_ghz): """Set the frequency grid on which to perform the calculations. **Call signature** *n* The number of frequency points to sample. *f_lo_ghz* The lowest frequency to sample, in GHz. *f_hi_ghz* The highest f...
python
def set_freqs(self, n, f_lo_ghz, f_hi_ghz): """Set the frequency grid on which to perform the calculations. **Call signature** *n* The number of frequency points to sample. *f_lo_ghz* The lowest frequency to sample, in GHz. *f_hi_ghz* The highest f...
[ "def", "set_freqs", "(", "self", ",", "n", ",", "f_lo_ghz", ",", "f_hi_ghz", ")", ":", "if", "not", "(", "f_lo_ghz", ">=", "0", ")", ":", "raise", "ValueError", "(", "'must have f_lo_ghz >= 0; got %r'", "%", "(", "f_lo_ghz", ",", ")", ")", "if", "not", ...
Set the frequency grid on which to perform the calculations. **Call signature** *n* The number of frequency points to sample. *f_lo_ghz* The lowest frequency to sample, in GHz. *f_hi_ghz* The highest frequency to sample, in GHz. Returns *...
[ "Set", "the", "frequency", "grid", "on", "which", "to", "perform", "the", "calculations", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/fk10.py#L471-L496
train
62,304
pkgw/pwkit
pwkit/fk10.py
Calculator.set_obs_angle
def set_obs_angle(self, theta_rad): """Set the observer angle relative to the field. **Call signature** *theta_rad* The angle between the ray path and the local magnetic field, in radians. Returns *self* for convenience in chaining. """ sel...
python
def set_obs_angle(self, theta_rad): """Set the observer angle relative to the field. **Call signature** *theta_rad* The angle between the ray path and the local magnetic field, in radians. Returns *self* for convenience in chaining. """ sel...
[ "def", "set_obs_angle", "(", "self", ",", "theta_rad", ")", ":", "self", ".", "in_vals", "[", "IN_VAL_THETA", "]", "=", "theta_rad", "*", "180", "/", "np", ".", "pi", "# rad => deg", "return", "self" ]
Set the observer angle relative to the field. **Call signature** *theta_rad* The angle between the ray path and the local magnetic field, in radians. Returns *self* for convenience in chaining.
[ "Set", "the", "observer", "angle", "relative", "to", "the", "field", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/fk10.py#L550-L562
train
62,305
pkgw/pwkit
pwkit/fk10.py
Calculator.set_one_freq
def set_one_freq(self, f_ghz): """Set the code to calculate results at just one frequency. **Call signature** *f_ghz* The frequency to sample, in GHz. Returns *self* for convenience in chaining. """ if not (f_ghz >= 0): raise ValueError(...
python
def set_one_freq(self, f_ghz): """Set the code to calculate results at just one frequency. **Call signature** *f_ghz* The frequency to sample, in GHz. Returns *self* for convenience in chaining. """ if not (f_ghz >= 0): raise ValueError(...
[ "def", "set_one_freq", "(", "self", ",", "f_ghz", ")", ":", "if", "not", "(", "f_ghz", ">=", "0", ")", ":", "raise", "ValueError", "(", "'must have f_lo_ghz >= 0; got %r'", "%", "(", "f_lo_ghz", ",", ")", ")", "self", ".", "in_vals", "[", "IN_VAL_NFREQ", ...
Set the code to calculate results at just one frequency. **Call signature** *f_ghz* The frequency to sample, in GHz. Returns *self* for convenience in chaining.
[ "Set", "the", "code", "to", "calculate", "results", "at", "just", "one", "frequency", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/fk10.py#L565-L582
train
62,306
pkgw/pwkit
pwkit/fk10.py
Calculator.set_padist_gaussian_loss_cone
def set_padist_gaussian_loss_cone(self, boundary_rad, expwidth): """Set the pitch-angle distribution to a Gaussian loss cone. **Call signature** *boundary_rad* The angle inside which there are no losses, in radians. *expwidth* The characteristic width of the Gaussia...
python
def set_padist_gaussian_loss_cone(self, boundary_rad, expwidth): """Set the pitch-angle distribution to a Gaussian loss cone. **Call signature** *boundary_rad* The angle inside which there are no losses, in radians. *expwidth* The characteristic width of the Gaussia...
[ "def", "set_padist_gaussian_loss_cone", "(", "self", ",", "boundary_rad", ",", "expwidth", ")", ":", "self", ".", "in_vals", "[", "IN_VAL_PADIST", "]", "=", "PADIST_GLC", "self", ".", "in_vals", "[", "IN_VAL_LCBDY", "]", "=", "boundary_rad", "*", "180", "/", ...
Set the pitch-angle distribution to a Gaussian loss cone. **Call signature** *boundary_rad* The angle inside which there are no losses, in radians. *expwidth* The characteristic width of the Gaussian loss profile *in direction-cosine units*. Returns ...
[ "Set", "the", "pitch", "-", "angle", "distribution", "to", "a", "Gaussian", "loss", "cone", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/fk10.py#L585-L606
train
62,307
pkgw/pwkit
pwkit/fk10.py
Calculator.set_thermal_background
def set_thermal_background(self, T_K, nth_cc): """Set the properties of the background thermal plasma. **Call signature** *T_K* The temperature of the background plasma, in Kelvin. *nth_cc* The number density of thermal electrons, in cm^-3. Returns ...
python
def set_thermal_background(self, T_K, nth_cc): """Set the properties of the background thermal plasma. **Call signature** *T_K* The temperature of the background plasma, in Kelvin. *nth_cc* The number density of thermal electrons, in cm^-3. Returns ...
[ "def", "set_thermal_background", "(", "self", ",", "T_K", ",", "nth_cc", ")", ":", "if", "not", "(", "T_K", ">=", "0", ")", ":", "raise", "ValueError", "(", "'must have T_K >= 0; got %r'", "%", "(", "T_K", ",", ")", ")", "if", "not", "(", "nth_cc", ">=...
Set the properties of the background thermal plasma. **Call signature** *T_K* The temperature of the background plasma, in Kelvin. *nth_cc* The number density of thermal electrons, in cm^-3. Returns *self* for convenience in chaining. Note that th...
[ "Set", "the", "properties", "of", "the", "background", "thermal", "plasma", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/fk10.py#L640-L669
train
62,308
pkgw/pwkit
pwkit/fk10.py
Calculator.set_trapezoidal_integration
def set_trapezoidal_integration(self, n): """Set the code to use trapezoidal integration. **Call signature** *n* Use this many nodes Returns *self* for convenience in chaining. """ if not (n >= 2): raise ValueError('must have n >= 2; got...
python
def set_trapezoidal_integration(self, n): """Set the code to use trapezoidal integration. **Call signature** *n* Use this many nodes Returns *self* for convenience in chaining. """ if not (n >= 2): raise ValueError('must have n >= 2; got...
[ "def", "set_trapezoidal_integration", "(", "self", ",", "n", ")", ":", "if", "not", "(", "n", ">=", "2", ")", ":", "raise", "ValueError", "(", "'must have n >= 2; got %r'", "%", "(", "n", ",", ")", ")", "self", ".", "in_vals", "[", "IN_VAL_INTEG_METH", "...
Set the code to use trapezoidal integration. **Call signature** *n* Use this many nodes Returns *self* for convenience in chaining.
[ "Set", "the", "code", "to", "use", "trapezoidal", "integration", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/fk10.py#L672-L687
train
62,309
pkgw/pwkit
pwkit/fk10.py
Calculator.find_rt_coefficients
def find_rt_coefficients(self, depth0=None): """Figure out emission and absorption coefficients for the current parameters. **Argument** *depth0* (default None) A first guess to use for a good integration depth, in cm. If None, the most recent value is used. **Retu...
python
def find_rt_coefficients(self, depth0=None): """Figure out emission and absorption coefficients for the current parameters. **Argument** *depth0* (default None) A first guess to use for a good integration depth, in cm. If None, the most recent value is used. **Retu...
[ "def", "find_rt_coefficients", "(", "self", ",", "depth0", "=", "None", ")", ":", "if", "self", ".", "in_vals", "[", "IN_VAL_NFREQ", "]", "!=", "1", ":", "raise", "Exception", "(", "'must have nfreq=1 to run Calculator.find_rt_coefficients()'", ")", "if", "depth0"...
Figure out emission and absorption coefficients for the current parameters. **Argument** *depth0* (default None) A first guess to use for a good integration depth, in cm. If None, the most recent value is used. **Return value** A tuple ``(j_O, alpha_O, j_X, alpha_...
[ "Figure", "out", "emission", "and", "absorption", "coefficients", "for", "the", "current", "parameters", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/fk10.py#L690-L805
train
62,310
pkgw/pwkit
pwkit/fk10.py
Calculator.find_rt_coefficients_tot_intens
def find_rt_coefficients_tot_intens(self, depth0=None): """Figure out total-intensity emission and absorption coefficients for the current parameters. **Argument** *depth0* (default None) A first guess to use for a good integration depth, in cm. If None, the most re...
python
def find_rt_coefficients_tot_intens(self, depth0=None): """Figure out total-intensity emission and absorption coefficients for the current parameters. **Argument** *depth0* (default None) A first guess to use for a good integration depth, in cm. If None, the most re...
[ "def", "find_rt_coefficients_tot_intens", "(", "self", ",", "depth0", "=", "None", ")", ":", "j_O", ",", "alpha_O", ",", "j_X", ",", "alpha_X", "=", "self", ".", "find_rt_coefficients", "(", "depth0", "=", "depth0", ")", "j_I", "=", "j_O", "+", "j_X", "a...
Figure out total-intensity emission and absorption coefficients for the current parameters. **Argument** *depth0* (default None) A first guess to use for a good integration depth, in cm. If None, the most recent value is used. **Return value** A tuple ``(j...
[ "Figure", "out", "total", "-", "intensity", "emission", "and", "absorption", "coefficients", "for", "the", "current", "parameters", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/fk10.py#L808-L835
train
62,311
pkgw/pwkit
pwkit/io.py
make_path_func
def make_path_func (*baseparts): """Return a function that joins paths onto some base directory.""" from os.path import join base = join (*baseparts) def path_func (*args): return join (base, *args) return path_func
python
def make_path_func (*baseparts): """Return a function that joins paths onto some base directory.""" from os.path import join base = join (*baseparts) def path_func (*args): return join (base, *args) return path_func
[ "def", "make_path_func", "(", "*", "baseparts", ")", ":", "from", "os", ".", "path", "import", "join", "base", "=", "join", "(", "*", "baseparts", ")", "def", "path_func", "(", "*", "args", ")", ":", "return", "join", "(", "base", ",", "*", "args", ...
Return a function that joins paths onto some base directory.
[ "Return", "a", "function", "that", "joins", "paths", "onto", "some", "base", "directory", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/io.py#L125-L131
train
62,312
pkgw/pwkit
pwkit/io.py
djoin
def djoin (*args): """'dotless' join, for nicer paths.""" from os.path import join i = 0 alen = len (args) while i < alen and (args[i] == '' or args[i] == '.'): i += 1 if i == alen: return '.' return join (*args[i:])
python
def djoin (*args): """'dotless' join, for nicer paths.""" from os.path import join i = 0 alen = len (args) while i < alen and (args[i] == '' or args[i] == '.'): i += 1 if i == alen: return '.' return join (*args[i:])
[ "def", "djoin", "(", "*", "args", ")", ":", "from", "os", ".", "path", "import", "join", "i", "=", "0", "alen", "=", "len", "(", "args", ")", "while", "i", "<", "alen", "and", "(", "args", "[", "i", "]", "==", "''", "or", "args", "[", "i", ...
dotless' join, for nicer paths.
[ "dotless", "join", "for", "nicer", "paths", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/io.py#L134-L147
train
62,313
pkgw/pwkit
pwkit/io.py
ensure_symlink
def ensure_symlink (src, dst): """Ensure the existence of a symbolic link pointing to src named dst. Returns a boolean indicating whether the symlink already existed. """ try: os.symlink (src, dst) except OSError as e: if e.errno == 17: # EEXIST return True raise...
python
def ensure_symlink (src, dst): """Ensure the existence of a symbolic link pointing to src named dst. Returns a boolean indicating whether the symlink already existed. """ try: os.symlink (src, dst) except OSError as e: if e.errno == 17: # EEXIST return True raise...
[ "def", "ensure_symlink", "(", "src", ",", "dst", ")", ":", "try", ":", "os", ".", "symlink", "(", "src", ",", "dst", ")", "except", "OSError", "as", "e", ":", "if", "e", ".", "errno", "==", "17", ":", "# EEXIST", "return", "True", "raise", "return"...
Ensure the existence of a symbolic link pointing to src named dst. Returns a boolean indicating whether the symlink already existed.
[ "Ensure", "the", "existence", "of", "a", "symbolic", "link", "pointing", "to", "src", "named", "dst", ".", "Returns", "a", "boolean", "indicating", "whether", "the", "symlink", "already", "existed", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/io.py#L189-L200
train
62,314
pkgw/pwkit
pwkit/io.py
Path.ensure_dir
def ensure_dir (self, mode=0o777, parents=False): """Ensure that this path exists as a directory. This function calls :meth:`mkdir` on this path, but does not raise an exception if it already exists. It does raise an exception if this path exists but is not a directory. If the directory...
python
def ensure_dir (self, mode=0o777, parents=False): """Ensure that this path exists as a directory. This function calls :meth:`mkdir` on this path, but does not raise an exception if it already exists. It does raise an exception if this path exists but is not a directory. If the directory...
[ "def", "ensure_dir", "(", "self", ",", "mode", "=", "0o777", ",", "parents", "=", "False", ")", ":", "if", "parents", ":", "p", "=", "self", ".", "parent", "if", "p", "==", "self", ":", "return", "False", "# can never create root; avoids loop when parents=Tr...
Ensure that this path exists as a directory. This function calls :meth:`mkdir` on this path, but does not raise an exception if it already exists. It does raise an exception if this path exists but is not a directory. If the directory is created, *mode* is used to set the permissions of...
[ "Ensure", "that", "this", "path", "exists", "as", "a", "directory", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/io.py#L402-L437
train
62,315
pkgw/pwkit
pwkit/io.py
Path.make_tempfile
def make_tempfile (self, want='handle', resolution='try_unlink', suffix='', **kwargs): """Get a context manager that creates and cleans up a uniquely-named temporary file with a name similar to this path. This function returns a context manager that creates a secure temporary file with ...
python
def make_tempfile (self, want='handle', resolution='try_unlink', suffix='', **kwargs): """Get a context manager that creates and cleans up a uniquely-named temporary file with a name similar to this path. This function returns a context manager that creates a secure temporary file with ...
[ "def", "make_tempfile", "(", "self", ",", "want", "=", "'handle'", ",", "resolution", "=", "'try_unlink'", ",", "suffix", "=", "''", ",", "*", "*", "kwargs", ")", ":", "if", "want", "not", "in", "(", "'handle'", ",", "'path'", ")", ":", "raise", "Val...
Get a context manager that creates and cleans up a uniquely-named temporary file with a name similar to this path. This function returns a context manager that creates a secure temporary file with a path similar to *self*. In particular, if ``str(self)`` is something like ``foo/bar``, t...
[ "Get", "a", "context", "manager", "that", "creates", "and", "cleans", "up", "a", "uniquely", "-", "named", "temporary", "file", "with", "a", "name", "similar", "to", "this", "path", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/io.py#L516-L574
train
62,316
pkgw/pwkit
pwkit/io.py
Path.try_unlink
def try_unlink (self): """Try to unlink this path. If it doesn't exist, no error is returned. Returns a boolean indicating whether the path was really unlinked. """ try: self.unlink () return True except OSError as e: if e.errno == 2: ...
python
def try_unlink (self): """Try to unlink this path. If it doesn't exist, no error is returned. Returns a boolean indicating whether the path was really unlinked. """ try: self.unlink () return True except OSError as e: if e.errno == 2: ...
[ "def", "try_unlink", "(", "self", ")", ":", "try", ":", "self", ".", "unlink", "(", ")", "return", "True", "except", "OSError", "as", "e", ":", "if", "e", ".", "errno", "==", "2", ":", "return", "False", "# ENOENT", "raise" ]
Try to unlink this path. If it doesn't exist, no error is returned. Returns a boolean indicating whether the path was really unlinked.
[ "Try", "to", "unlink", "this", "path", ".", "If", "it", "doesn", "t", "exist", "no", "error", "is", "returned", ".", "Returns", "a", "boolean", "indicating", "whether", "the", "path", "was", "really", "unlinked", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/io.py#L645-L656
train
62,317
pkgw/pwkit
pwkit/io.py
Path.read_pickles
def read_pickles (self): """Generate a sequence of objects by opening the path and unpickling items until EOF is reached. """ try: import cPickle as pickle except ImportError: import pickle with self.open (mode='rb') as f: while True:...
python
def read_pickles (self): """Generate a sequence of objects by opening the path and unpickling items until EOF is reached. """ try: import cPickle as pickle except ImportError: import pickle with self.open (mode='rb') as f: while True:...
[ "def", "read_pickles", "(", "self", ")", ":", "try", ":", "import", "cPickle", "as", "pickle", "except", "ImportError", ":", "import", "pickle", "with", "self", ".", "open", "(", "mode", "=", "'rb'", ")", "as", "f", ":", "while", "True", ":", "try", ...
Generate a sequence of objects by opening the path and unpickling items until EOF is reached.
[ "Generate", "a", "sequence", "of", "objects", "by", "opening", "the", "path", "and", "unpickling", "items", "until", "EOF", "is", "reached", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/io.py#L923-L939
train
62,318
pkgw/pwkit
pwkit/io.py
Path.read_text
def read_text(self, encoding=None, errors=None, newline=None): """Read this path as one large chunk of text. This function reads in the entire file as one big piece of text and returns it. The *encoding*, *errors*, and *newline* keywords are passed to :meth:`open`. This is not ...
python
def read_text(self, encoding=None, errors=None, newline=None): """Read this path as one large chunk of text. This function reads in the entire file as one big piece of text and returns it. The *encoding*, *errors*, and *newline* keywords are passed to :meth:`open`. This is not ...
[ "def", "read_text", "(", "self", ",", "encoding", "=", "None", ",", "errors", "=", "None", ",", "newline", "=", "None", ")", ":", "with", "self", ".", "open", "(", "mode", "=", "'rt'", ",", "encoding", "=", "encoding", ",", "errors", "=", "errors", ...
Read this path as one large chunk of text. This function reads in the entire file as one big piece of text and returns it. The *encoding*, *errors*, and *newline* keywords are passed to :meth:`open`. This is not a good way to read files unless you know for sure that they are sm...
[ "Read", "this", "path", "as", "one", "large", "chunk", "of", "text", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/io.py#L964-L976
train
62,319
pkgw/pwkit
pwkit/io.py
Path.read_toml
def read_toml(self, encoding=None, errors=None, newline=None, **kwargs): """Read this path as a TOML document. The `TOML <https://github.com/toml-lang/toml>`_ parsing is done with the :mod:`pytoml` module. The *encoding*, *errors*, and *newline* keywords are passed to :meth:`open`. The ...
python
def read_toml(self, encoding=None, errors=None, newline=None, **kwargs): """Read this path as a TOML document. The `TOML <https://github.com/toml-lang/toml>`_ parsing is done with the :mod:`pytoml` module. The *encoding*, *errors*, and *newline* keywords are passed to :meth:`open`. The ...
[ "def", "read_toml", "(", "self", ",", "encoding", "=", "None", ",", "errors", "=", "None", ",", "newline", "=", "None", ",", "*", "*", "kwargs", ")", ":", "import", "pytoml", "with", "self", ".", "open", "(", "mode", "=", "'rt'", ",", "encoding", "...
Read this path as a TOML document. The `TOML <https://github.com/toml-lang/toml>`_ parsing is done with the :mod:`pytoml` module. The *encoding*, *errors*, and *newline* keywords are passed to :meth:`open`. The remaining *kwargs* are passed to :meth:`toml.load`. Returns the dec...
[ "Read", "this", "path", "as", "a", "TOML", "document", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/io.py#L979-L993
train
62,320
pkgw/pwkit
pwkit/io.py
Path.read_yaml
def read_yaml (self, encoding=None, errors=None, newline=None, **kwargs): """Read this path as a YAML document. The YAML parsing is done with the :mod:`yaml` module. The *encoding*, *errors*, and *newline* keywords are passed to :meth:`open`. The remaining *kwargs* are passed to :meth:`...
python
def read_yaml (self, encoding=None, errors=None, newline=None, **kwargs): """Read this path as a YAML document. The YAML parsing is done with the :mod:`yaml` module. The *encoding*, *errors*, and *newline* keywords are passed to :meth:`open`. The remaining *kwargs* are passed to :meth:`...
[ "def", "read_yaml", "(", "self", ",", "encoding", "=", "None", ",", "errors", "=", "None", ",", "newline", "=", "None", ",", "*", "*", "kwargs", ")", ":", "import", "yaml", "with", "self", ".", "open", "(", "mode", "=", "'rt'", ",", "encoding", "="...
Read this path as a YAML document. The YAML parsing is done with the :mod:`yaml` module. The *encoding*, *errors*, and *newline* keywords are passed to :meth:`open`. The remaining *kwargs* are passed to :meth:`yaml.load`. Returns the decoded data structure.
[ "Read", "this", "path", "as", "a", "YAML", "document", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/io.py#L996-L1009
train
62,321
pkgw/pwkit
pwkit/simpleenum.py
enumeration
def enumeration (cls): """A very simple decorator for creating enumerations. Unlike Python 3.4 enumerations, this just gives a way to use a class declaration to create an immutable object containing only the values specified in the class. If the attribute ``__pickle_compat__`` is set to True in the dec...
python
def enumeration (cls): """A very simple decorator for creating enumerations. Unlike Python 3.4 enumerations, this just gives a way to use a class declaration to create an immutable object containing only the values specified in the class. If the attribute ``__pickle_compat__`` is set to True in the dec...
[ "def", "enumeration", "(", "cls", ")", ":", "from", "pwkit", "import", "unicode_to_str", "name", "=", "cls", ".", "__name__", "pickle_compat", "=", "getattr", "(", "cls", ",", "'__pickle_compat__'", ",", "False", ")", "def", "__unicode__", "(", "self", ")", ...
A very simple decorator for creating enumerations. Unlike Python 3.4 enumerations, this just gives a way to use a class declaration to create an immutable object containing only the values specified in the class. If the attribute ``__pickle_compat__`` is set to True in the decorated class, the resultin...
[ "A", "very", "simple", "decorator", "for", "creating", "enumerations", ".", "Unlike", "Python", "3", ".", "4", "enumerations", "this", "just", "gives", "a", "way", "to", "use", "a", "class", "declaration", "to", "create", "an", "immutable", "object", "contai...
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/simpleenum.py#L45-L88
train
62,322
pkgw/pwkit
pwkit/numutil.py
slice_around_gaps
def slice_around_gaps (values, maxgap): """Given an ordered array of values, generate a set of slices that traverse all of the values. Within each slice, no gap between adjacent values is larger than `maxgap`. In other words, these slices break the array into chunks separated by gaps of size larger than...
python
def slice_around_gaps (values, maxgap): """Given an ordered array of values, generate a set of slices that traverse all of the values. Within each slice, no gap between adjacent values is larger than `maxgap`. In other words, these slices break the array into chunks separated by gaps of size larger than...
[ "def", "slice_around_gaps", "(", "values", ",", "maxgap", ")", ":", "if", "not", "(", "maxgap", ">", "0", ")", ":", "# above test catches NaNs, other weird cases", "raise", "ValueError", "(", "'maxgap must be positive; got %r'", "%", "maxgap", ")", "values", "=", ...
Given an ordered array of values, generate a set of slices that traverse all of the values. Within each slice, no gap between adjacent values is larger than `maxgap`. In other words, these slices break the array into chunks separated by gaps of size larger than maxgap.
[ "Given", "an", "ordered", "array", "of", "values", "generate", "a", "set", "of", "slices", "that", "traverse", "all", "of", "the", "values", ".", "Within", "each", "slice", "no", "gap", "between", "adjacent", "values", "is", "larger", "than", "maxgap", "."...
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/numutil.py#L221-L245
train
62,323
pkgw/pwkit
pwkit/numutil.py
reduce_data_frame
def reduce_data_frame (df, chunk_slicers, avg_cols=(), uavg_cols=(), minmax_cols=(), nchunk_colname='nchunk', uncert_prefix='u', min_points_per_chunk=3): """"Reduce" a DataFrame ...
python
def reduce_data_frame (df, chunk_slicers, avg_cols=(), uavg_cols=(), minmax_cols=(), nchunk_colname='nchunk', uncert_prefix='u', min_points_per_chunk=3): """"Reduce" a DataFrame ...
[ "def", "reduce_data_frame", "(", "df", ",", "chunk_slicers", ",", "avg_cols", "=", "(", ")", ",", "uavg_cols", "=", "(", ")", ",", "minmax_cols", "=", "(", ")", ",", "nchunk_colname", "=", "'nchunk'", ",", "uncert_prefix", "=", "'u'", ",", "min_points_per_...
Reduce" a DataFrame by collapsing rows in grouped chunks. Returns another DataFrame with similar columns but fewer rows. Arguments: df The input :class:`pandas.DataFrame`. chunk_slicers An iterable that returns values that are used to slice *df* with its :meth:`pandas.DataFrame.iloc`...
[ "Reduce", "a", "DataFrame", "by", "collapsing", "rows", "in", "grouped", "chunks", ".", "Returns", "another", "DataFrame", "with", "similar", "columns", "but", "fewer", "rows", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/numutil.py#L283-L348
train
62,324
pkgw/pwkit
pwkit/numutil.py
reduce_data_frame_evenly_with_gaps
def reduce_data_frame_evenly_with_gaps (df, valcol, target_len, maxgap, **kwargs): """"Reduce" a DataFrame by collapsing rows in grouped chunks, grouping based on gaps in one of the columns. This function combines :func:`reduce_data_frame` with :func:`slice_evenly_with_gaps`. """ return reduce...
python
def reduce_data_frame_evenly_with_gaps (df, valcol, target_len, maxgap, **kwargs): """"Reduce" a DataFrame by collapsing rows in grouped chunks, grouping based on gaps in one of the columns. This function combines :func:`reduce_data_frame` with :func:`slice_evenly_with_gaps`. """ return reduce...
[ "def", "reduce_data_frame_evenly_with_gaps", "(", "df", ",", "valcol", ",", "target_len", ",", "maxgap", ",", "*", "*", "kwargs", ")", ":", "return", "reduce_data_frame", "(", "df", ",", "slice_evenly_with_gaps", "(", "df", "[", "valcol", "]", ",", "target_len...
Reduce" a DataFrame by collapsing rows in grouped chunks, grouping based on gaps in one of the columns. This function combines :func:`reduce_data_frame` with :func:`slice_evenly_with_gaps`.
[ "Reduce", "a", "DataFrame", "by", "collapsing", "rows", "in", "grouped", "chunks", "grouping", "based", "on", "gaps", "in", "one", "of", "the", "columns", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/numutil.py#L351-L361
train
62,325
pkgw/pwkit
pwkit/numutil.py
usmooth
def usmooth (window, uncerts, *data, **kwargs): """Smooth data series according to a window, weighting based on uncertainties. Arguments: window The smoothing window. uncerts An array of uncertainties used to weight the smoothing. data One or more data series, of the same size as...
python
def usmooth (window, uncerts, *data, **kwargs): """Smooth data series according to a window, weighting based on uncertainties. Arguments: window The smoothing window. uncerts An array of uncertainties used to weight the smoothing. data One or more data series, of the same size as...
[ "def", "usmooth", "(", "window", ",", "uncerts", ",", "*", "data", ",", "*", "*", "kwargs", ")", ":", "window", "=", "np", ".", "asarray", "(", "window", ")", "uncerts", "=", "np", ".", "asarray", "(", "uncerts", ")", "# Hacky keyword argument handling b...
Smooth data series according to a window, weighting based on uncertainties. Arguments: window The smoothing window. uncerts An array of uncertainties used to weight the smoothing. data One or more data series, of the same size as *uncerts*. k = None If specified, only every...
[ "Smooth", "data", "series", "according", "to", "a", "window", "weighting", "based", "on", "uncertainties", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/numutil.py#L366-L420
train
62,326
pkgw/pwkit
pwkit/numutil.py
weighted_variance
def weighted_variance (x, weights): """Return the variance of a weighted sample. The weighted sample mean is calculated and subtracted off, so the returned variance is upweighted by ``n / (n - 1)``. If the sample mean is known to be zero, you should just compute ``np.average (x**2, weights=weights)``. ...
python
def weighted_variance (x, weights): """Return the variance of a weighted sample. The weighted sample mean is calculated and subtracted off, so the returned variance is upweighted by ``n / (n - 1)``. If the sample mean is known to be zero, you should just compute ``np.average (x**2, weights=weights)``. ...
[ "def", "weighted_variance", "(", "x", ",", "weights", ")", ":", "n", "=", "len", "(", "x", ")", "if", "n", "<", "3", ":", "raise", "ValueError", "(", "'cannot calculate meaningful variance of fewer '", "'than three samples'", ")", "wt_mean", "=", "np", ".", ...
Return the variance of a weighted sample. The weighted sample mean is calculated and subtracted off, so the returned variance is upweighted by ``n / (n - 1)``. If the sample mean is known to be zero, you should just compute ``np.average (x**2, weights=weights)``.
[ "Return", "the", "variance", "of", "a", "weighted", "sample", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/numutil.py#L674-L687
train
62,327
pkgw/pwkit
pwkit/numutil.py
unit_tophat_ee
def unit_tophat_ee (x): """Tophat function on the unit interval, left-exclusive and right-exclusive. Returns 1 if 0 < x < 1, 0 otherwise. """ x = np.asarray (x) x1 = np.atleast_1d (x) r = ((0 < x1) & (x1 < 1)).astype (x.dtype) if x.ndim == 0: return np.asscalar (r) return r
python
def unit_tophat_ee (x): """Tophat function on the unit interval, left-exclusive and right-exclusive. Returns 1 if 0 < x < 1, 0 otherwise. """ x = np.asarray (x) x1 = np.atleast_1d (x) r = ((0 < x1) & (x1 < 1)).astype (x.dtype) if x.ndim == 0: return np.asscalar (r) return r
[ "def", "unit_tophat_ee", "(", "x", ")", ":", "x", "=", "np", ".", "asarray", "(", "x", ")", "x1", "=", "np", ".", "atleast_1d", "(", "x", ")", "r", "=", "(", "(", "0", "<", "x1", ")", "&", "(", "x1", "<", "1", ")", ")", ".", "astype", "("...
Tophat function on the unit interval, left-exclusive and right-exclusive. Returns 1 if 0 < x < 1, 0 otherwise.
[ "Tophat", "function", "on", "the", "unit", "interval", "left", "-", "exclusive", "and", "right", "-", "exclusive", ".", "Returns", "1", "if", "0", "<", "x", "<", "1", "0", "otherwise", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/numutil.py#L698-L708
train
62,328
pkgw/pwkit
pwkit/numutil.py
make_tophat_ee
def make_tophat_ee (lower, upper): """Return a ufunc-like tophat function on the defined range, left-exclusive and right-exclusive. Returns 1 if lower < x < upper, 0 otherwise. """ if not np.isfinite (lower): raise ValueError ('"lower" argument must be finite number; got %r' % lower) if not...
python
def make_tophat_ee (lower, upper): """Return a ufunc-like tophat function on the defined range, left-exclusive and right-exclusive. Returns 1 if lower < x < upper, 0 otherwise. """ if not np.isfinite (lower): raise ValueError ('"lower" argument must be finite number; got %r' % lower) if not...
[ "def", "make_tophat_ee", "(", "lower", ",", "upper", ")", ":", "if", "not", "np", ".", "isfinite", "(", "lower", ")", ":", "raise", "ValueError", "(", "'\"lower\" argument must be finite number; got %r'", "%", "lower", ")", "if", "not", "np", ".", "isfinite", ...
Return a ufunc-like tophat function on the defined range, left-exclusive and right-exclusive. Returns 1 if lower < x < upper, 0 otherwise.
[ "Return", "a", "ufunc", "-", "like", "tophat", "function", "on", "the", "defined", "range", "left", "-", "exclusive", "and", "right", "-", "exclusive", ".", "Returns", "1", "if", "lower", "<", "x", "<", "upper", "0", "otherwise", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/numutil.py#L750-L771
train
62,329
pkgw/pwkit
pwkit/numutil.py
make_tophat_ei
def make_tophat_ei (lower, upper): """Return a ufunc-like tophat function on the defined range, left-exclusive and right-inclusive. Returns 1 if lower < x <= upper, 0 otherwise. """ if not np.isfinite (lower): raise ValueError ('"lower" argument must be finite number; got %r' % lower) if no...
python
def make_tophat_ei (lower, upper): """Return a ufunc-like tophat function on the defined range, left-exclusive and right-inclusive. Returns 1 if lower < x <= upper, 0 otherwise. """ if not np.isfinite (lower): raise ValueError ('"lower" argument must be finite number; got %r' % lower) if no...
[ "def", "make_tophat_ei", "(", "lower", ",", "upper", ")", ":", "if", "not", "np", ".", "isfinite", "(", "lower", ")", ":", "raise", "ValueError", "(", "'\"lower\" argument must be finite number; got %r'", "%", "lower", ")", "if", "not", "np", ".", "isfinite", ...
Return a ufunc-like tophat function on the defined range, left-exclusive and right-inclusive. Returns 1 if lower < x <= upper, 0 otherwise.
[ "Return", "a", "ufunc", "-", "like", "tophat", "function", "on", "the", "defined", "range", "left", "-", "exclusive", "and", "right", "-", "inclusive", ".", "Returns", "1", "if", "lower", "<", "x", "<", "=", "upper", "0", "otherwise", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/numutil.py#L774-L795
train
62,330
pkgw/pwkit
pwkit/numutil.py
make_tophat_ie
def make_tophat_ie (lower, upper): """Return a ufunc-like tophat function on the defined range, left-inclusive and right-exclusive. Returns 1 if lower <= x < upper, 0 otherwise. """ if not np.isfinite (lower): raise ValueError ('"lower" argument must be finite number; got %r' % lower) if no...
python
def make_tophat_ie (lower, upper): """Return a ufunc-like tophat function on the defined range, left-inclusive and right-exclusive. Returns 1 if lower <= x < upper, 0 otherwise. """ if not np.isfinite (lower): raise ValueError ('"lower" argument must be finite number; got %r' % lower) if no...
[ "def", "make_tophat_ie", "(", "lower", ",", "upper", ")", ":", "if", "not", "np", ".", "isfinite", "(", "lower", ")", ":", "raise", "ValueError", "(", "'\"lower\" argument must be finite number; got %r'", "%", "lower", ")", "if", "not", "np", ".", "isfinite", ...
Return a ufunc-like tophat function on the defined range, left-inclusive and right-exclusive. Returns 1 if lower <= x < upper, 0 otherwise.
[ "Return", "a", "ufunc", "-", "like", "tophat", "function", "on", "the", "defined", "range", "left", "-", "inclusive", "and", "right", "-", "exclusive", ".", "Returns", "1", "if", "lower", "<", "=", "x", "<", "upper", "0", "otherwise", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/numutil.py#L798-L819
train
62,331
pkgw/pwkit
pwkit/numutil.py
make_tophat_ii
def make_tophat_ii (lower, upper): """Return a ufunc-like tophat function on the defined range, left-inclusive and right-inclusive. Returns 1 if lower < x < upper, 0 otherwise. """ if not np.isfinite (lower): raise ValueError ('"lower" argument must be finite number; got %r' % lower) if not...
python
def make_tophat_ii (lower, upper): """Return a ufunc-like tophat function on the defined range, left-inclusive and right-inclusive. Returns 1 if lower < x < upper, 0 otherwise. """ if not np.isfinite (lower): raise ValueError ('"lower" argument must be finite number; got %r' % lower) if not...
[ "def", "make_tophat_ii", "(", "lower", ",", "upper", ")", ":", "if", "not", "np", ".", "isfinite", "(", "lower", ")", ":", "raise", "ValueError", "(", "'\"lower\" argument must be finite number; got %r'", "%", "lower", ")", "if", "not", "np", ".", "isfinite", ...
Return a ufunc-like tophat function on the defined range, left-inclusive and right-inclusive. Returns 1 if lower < x < upper, 0 otherwise.
[ "Return", "a", "ufunc", "-", "like", "tophat", "function", "on", "the", "defined", "range", "left", "-", "inclusive", "and", "right", "-", "inclusive", ".", "Returns", "1", "if", "lower", "<", "x", "<", "upper", "0", "otherwise", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/numutil.py#L822-L843
train
62,332
pkgw/pwkit
pwkit/numutil.py
make_step_lcont
def make_step_lcont (transition): """Return a ufunc-like step function that is left-continuous. Returns 1 if x > transition, 0 otherwise. """ if not np.isfinite (transition): raise ValueError ('"transition" argument must be finite number; got %r' % transition) def step_lcont (x): x...
python
def make_step_lcont (transition): """Return a ufunc-like step function that is left-continuous. Returns 1 if x > transition, 0 otherwise. """ if not np.isfinite (transition): raise ValueError ('"transition" argument must be finite number; got %r' % transition) def step_lcont (x): x...
[ "def", "make_step_lcont", "(", "transition", ")", ":", "if", "not", "np", ".", "isfinite", "(", "transition", ")", ":", "raise", "ValueError", "(", "'\"transition\" argument must be finite number; got %r'", "%", "transition", ")", "def", "step_lcont", "(", "x", ")...
Return a ufunc-like step function that is left-continuous. Returns 1 if x > transition, 0 otherwise.
[ "Return", "a", "ufunc", "-", "like", "step", "function", "that", "is", "left", "-", "continuous", ".", "Returns", "1", "if", "x", ">", "transition", "0", "otherwise", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/numutil.py#L848-L866
train
62,333
pkgw/pwkit
pwkit/numutil.py
make_step_rcont
def make_step_rcont (transition): """Return a ufunc-like step function that is right-continuous. Returns 1 if x >= transition, 0 otherwise. """ if not np.isfinite (transition): raise ValueError ('"transition" argument must be finite number; got %r' % transition) def step_rcont (x): ...
python
def make_step_rcont (transition): """Return a ufunc-like step function that is right-continuous. Returns 1 if x >= transition, 0 otherwise. """ if not np.isfinite (transition): raise ValueError ('"transition" argument must be finite number; got %r' % transition) def step_rcont (x): ...
[ "def", "make_step_rcont", "(", "transition", ")", ":", "if", "not", "np", ".", "isfinite", "(", "transition", ")", ":", "raise", "ValueError", "(", "'\"transition\" argument must be finite number; got %r'", "%", "transition", ")", "def", "step_rcont", "(", "x", ")...
Return a ufunc-like step function that is right-continuous. Returns 1 if x >= transition, 0 otherwise.
[ "Return", "a", "ufunc", "-", "like", "step", "function", "that", "is", "right", "-", "continuous", ".", "Returns", "1", "if", "x", ">", "=", "transition", "0", "otherwise", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/numutil.py#L869-L887
train
62,334
pkgw/pwkit
pwkit/sherpa.py
make_fixed_temp_multi_apec
def make_fixed_temp_multi_apec(kTs, name_template='apec%d', norm=None): """Create a model summing multiple APEC components at fixed temperatures. *kTs* An iterable of temperatures for the components, in keV. *name_template* = 'apec%d' A template to use for the names of each component; it is str...
python
def make_fixed_temp_multi_apec(kTs, name_template='apec%d', norm=None): """Create a model summing multiple APEC components at fixed temperatures. *kTs* An iterable of temperatures for the components, in keV. *name_template* = 'apec%d' A template to use for the names of each component; it is str...
[ "def", "make_fixed_temp_multi_apec", "(", "kTs", ",", "name_template", "=", "'apec%d'", ",", "norm", "=", "None", ")", ":", "total_model", "=", "None", "sub_models", "=", "[", "]", "for", "i", ",", "kT", "in", "enumerate", "(", "kTs", ")", ":", "componen...
Create a model summing multiple APEC components at fixed temperatures. *kTs* An iterable of temperatures for the components, in keV. *name_template* = 'apec%d' A template to use for the names of each component; it is string-formatted with the 0-based component number as an argument. *norm...
[ "Create", "a", "model", "summing", "multiple", "APEC", "components", "at", "fixed", "temperatures", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/sherpa.py#L102-L140
train
62,335
pkgw/pwkit
pwkit/sherpa.py
expand_rmf_matrix
def expand_rmf_matrix(rmf): """Expand an RMF matrix stored in compressed form. *rmf* An RMF object as might be returned by ``sherpa.astro.ui.get_rmf()``. Returns: A non-sparse RMF matrix. The Response Matrix Function (RMF) of an X-ray telescope like Chandra can be stored in a sparse fo...
python
def expand_rmf_matrix(rmf): """Expand an RMF matrix stored in compressed form. *rmf* An RMF object as might be returned by ``sherpa.astro.ui.get_rmf()``. Returns: A non-sparse RMF matrix. The Response Matrix Function (RMF) of an X-ray telescope like Chandra can be stored in a sparse fo...
[ "def", "expand_rmf_matrix", "(", "rmf", ")", ":", "n_chan", "=", "rmf", ".", "e_min", ".", "size", "n_energy", "=", "rmf", ".", "n_grp", ".", "size", "expanded", "=", "np", ".", "zeros", "(", "(", "n_energy", ",", "n_chan", ")", ")", "mtx_ofs", "=", ...
Expand an RMF matrix stored in compressed form. *rmf* An RMF object as might be returned by ``sherpa.astro.ui.get_rmf()``. Returns: A non-sparse RMF matrix. The Response Matrix Function (RMF) of an X-ray telescope like Chandra can be stored in a sparse format as defined in `OGIP Calibratio...
[ "Expand", "an", "RMF", "matrix", "stored", "in", "compressed", "form", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/sherpa.py#L143-L175
train
62,336
pkgw/pwkit
pwkit/sherpa.py
derive_identity_arf
def derive_identity_arf(name, arf): """Create an "identity" ARF that has uniform sensitivity. *name* The name of the ARF object to be created; passed to Sherpa. *arf* An existing ARF object on which to base this one. Returns: A new ARF1D object that has a uniform spectral response vec...
python
def derive_identity_arf(name, arf): """Create an "identity" ARF that has uniform sensitivity. *name* The name of the ARF object to be created; passed to Sherpa. *arf* An existing ARF object on which to base this one. Returns: A new ARF1D object that has a uniform spectral response vec...
[ "def", "derive_identity_arf", "(", "name", ",", "arf", ")", ":", "from", "sherpa", ".", "astro", ".", "data", "import", "DataARF", "from", "sherpa", ".", "astro", ".", "instrument", "import", "ARF1D", "darf", "=", "DataARF", "(", "name", ",", "arf", ".",...
Create an "identity" ARF that has uniform sensitivity. *name* The name of the ARF object to be created; passed to Sherpa. *arf* An existing ARF object on which to base this one. Returns: A new ARF1D object that has a uniform spectral response vector. In many X-ray observations, the r...
[ "Create", "an", "identity", "ARF", "that", "has", "uniform", "sensitivity", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/sherpa.py#L340-L372
train
62,337
pkgw/pwkit
pwkit/sherpa.py
get_source_qq_data
def get_source_qq_data(id=None): """Get data for a quantile-quantile plot of the source data and model. *id* The dataset id for which to get the data; defaults if unspecified. Returns: An ndarray of shape ``(3, npts)``. The first slice is the energy axis in keV; the second is the observed...
python
def get_source_qq_data(id=None): """Get data for a quantile-quantile plot of the source data and model. *id* The dataset id for which to get the data; defaults if unspecified. Returns: An ndarray of shape ``(3, npts)``. The first slice is the energy axis in keV; the second is the observed...
[ "def", "get_source_qq_data", "(", "id", "=", "None", ")", ":", "sdata", "=", "ui", ".", "get_data", "(", "id", "=", "id", ")", "kev", "=", "sdata", ".", "get_x", "(", ")", "obs_data", "=", "sdata", ".", "counts", "model_data", "=", "ui", ".", "get_...
Get data for a quantile-quantile plot of the source data and model. *id* The dataset id for which to get the data; defaults if unspecified. Returns: An ndarray of shape ``(3, npts)``. The first slice is the energy axis in keV; the second is the observed values in each bin (counts, or rate, or...
[ "Get", "data", "for", "a", "quantile", "-", "quantile", "plot", "of", "the", "source", "data", "and", "model", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/sherpa.py#L375-L394
train
62,338
pkgw/pwkit
pwkit/sherpa.py
get_bkg_qq_data
def get_bkg_qq_data(id=None, bkg_id=None): """Get data for a quantile-quantile plot of the background data and model. *id* The dataset id for which to get the data; defaults if unspecified. *bkg_id* The identifier of the background; defaults if unspecified. Returns: An ndarray of shap...
python
def get_bkg_qq_data(id=None, bkg_id=None): """Get data for a quantile-quantile plot of the background data and model. *id* The dataset id for which to get the data; defaults if unspecified. *bkg_id* The identifier of the background; defaults if unspecified. Returns: An ndarray of shap...
[ "def", "get_bkg_qq_data", "(", "id", "=", "None", ",", "bkg_id", "=", "None", ")", ":", "bdata", "=", "ui", ".", "get_bkg", "(", "id", "=", "id", ",", "bkg_id", "=", "bkg_id", ")", "kev", "=", "bdata", ".", "get_x", "(", ")", "obs_data", "=", "bd...
Get data for a quantile-quantile plot of the background data and model. *id* The dataset id for which to get the data; defaults if unspecified. *bkg_id* The identifier of the background; defaults if unspecified. Returns: An ndarray of shape ``(3, npts)``. The first slice is the energy axi...
[ "Get", "data", "for", "a", "quantile", "-", "quantile", "plot", "of", "the", "background", "data", "and", "model", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/sherpa.py#L397-L418
train
62,339
pkgw/pwkit
pwkit/sherpa.py
make_qq_plot
def make_qq_plot(kev, obs, mdl, unit, key_text): """Make a quantile-quantile plot comparing events and a model. *kev* A 1D, sorted array of event energy bins measured in keV. *obs* A 1D array giving the number or rate of events in each bin. *mdl* A 1D array giving the modeled number o...
python
def make_qq_plot(kev, obs, mdl, unit, key_text): """Make a quantile-quantile plot comparing events and a model. *kev* A 1D, sorted array of event energy bins measured in keV. *obs* A 1D array giving the number or rate of events in each bin. *mdl* A 1D array giving the modeled number o...
[ "def", "make_qq_plot", "(", "kev", ",", "obs", ",", "mdl", ",", "unit", ",", "key_text", ")", ":", "import", "omega", "as", "om", "kev", "=", "np", ".", "asarray", "(", "kev", ")", "obs", "=", "np", ".", "asarray", "(", "obs", ")", "mdl", "=", ...
Make a quantile-quantile plot comparing events and a model. *kev* A 1D, sorted array of event energy bins measured in keV. *obs* A 1D array giving the number or rate of events in each bin. *mdl* A 1D array giving the modeled number or rate of events in each bin. *unit* Text desc...
[ "Make", "a", "quantile", "-", "quantile", "plot", "comparing", "events", "and", "a", "model", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/sherpa.py#L421-L475
train
62,340
pkgw/pwkit
pwkit/sherpa.py
make_multi_qq_plots
def make_multi_qq_plots(arrays, key_text): """Make a quantile-quantile plot comparing multiple sets of events and models. *arrays* X. *key_text* Text describing the quantile-quantile comparison quantity; will be shown on the plot legend. Returns: An :class:`omega.RectPlot` insta...
python
def make_multi_qq_plots(arrays, key_text): """Make a quantile-quantile plot comparing multiple sets of events and models. *arrays* X. *key_text* Text describing the quantile-quantile comparison quantity; will be shown on the plot legend. Returns: An :class:`omega.RectPlot` insta...
[ "def", "make_multi_qq_plots", "(", "arrays", ",", "key_text", ")", ":", "import", "omega", "as", "om", "p", "=", "om", ".", "RectPlot", "(", ")", "p", ".", "addXY", "(", "[", "0", ",", "1.", "]", ",", "[", "0", ",", "1.", "]", ",", "'1:1'", ")"...
Make a quantile-quantile plot comparing multiple sets of events and models. *arrays* X. *key_text* Text describing the quantile-quantile comparison quantity; will be shown on the plot legend. Returns: An :class:`omega.RectPlot` instance. *TODO*: nothing about this is Sherpa-spe...
[ "Make", "a", "quantile", "-", "quantile", "plot", "comparing", "multiple", "sets", "of", "events", "and", "models", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/sherpa.py#L478-L531
train
62,341
pkgw/pwkit
pwkit/sherpa.py
make_spectrum_plot
def make_spectrum_plot(model_plot, data_plot, desc, xmin_clamp=0.01, min_valid_x=None, max_valid_x=None): """Make a plot of a spectral model and data. *model_plot* A model plot object returned by Sherpa from a call like `ui.get_model_plot()` or `ui.get_bkg_model_plot()`. ...
python
def make_spectrum_plot(model_plot, data_plot, desc, xmin_clamp=0.01, min_valid_x=None, max_valid_x=None): """Make a plot of a spectral model and data. *model_plot* A model plot object returned by Sherpa from a call like `ui.get_model_plot()` or `ui.get_bkg_model_plot()`. ...
[ "def", "make_spectrum_plot", "(", "model_plot", ",", "data_plot", ",", "desc", ",", "xmin_clamp", "=", "0.01", ",", "min_valid_x", "=", "None", ",", "max_valid_x", "=", "None", ")", ":", "import", "omega", "as", "om", "model_x", "=", "np", ".", "concatenat...
Make a plot of a spectral model and data. *model_plot* A model plot object returned by Sherpa from a call like `ui.get_model_plot()` or `ui.get_bkg_model_plot()`. *data_plot* A data plot object returned by Sherpa from a call like `ui.get_source_plot()` or `ui.get_bkg_plot()`. *desc*...
[ "Make", "a", "plot", "of", "a", "spectral", "model", "and", "data", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/sherpa.py#L534-L606
train
62,342
bibanon/BASC-py4chan
examples/example6-download-thread.py
download_file
def download_file(local_filename, url, clobber=False): """Download the given file. Clobber overwrites file if exists.""" dir_name = os.path.dirname(local_filename) mkdirs(dir_name) if clobber or not os.path.exists(local_filename): i = requests.get(url) # if not exists if i.stat...
python
def download_file(local_filename, url, clobber=False): """Download the given file. Clobber overwrites file if exists.""" dir_name = os.path.dirname(local_filename) mkdirs(dir_name) if clobber or not os.path.exists(local_filename): i = requests.get(url) # if not exists if i.stat...
[ "def", "download_file", "(", "local_filename", ",", "url", ",", "clobber", "=", "False", ")", ":", "dir_name", "=", "os", ".", "path", ".", "dirname", "(", "local_filename", ")", "mkdirs", "(", "dir_name", ")", "if", "clobber", "or", "not", "os", ".", ...
Download the given file. Clobber overwrites file if exists.
[ "Download", "the", "given", "file", ".", "Clobber", "overwrites", "file", "if", "exists", "." ]
88e4866d73853e1025e549fbbe9744e750522359
https://github.com/bibanon/BASC-py4chan/blob/88e4866d73853e1025e549fbbe9744e750522359/examples/example6-download-thread.py#L14-L33
train
62,343
bibanon/BASC-py4chan
examples/example6-download-thread.py
download_json
def download_json(local_filename, url, clobber=False): """Download the given JSON file, and pretty-print before we output it.""" with open(local_filename, 'w') as json_file: json_file.write(json.dumps(requests.get(url).json(), sort_keys=True, indent=2, separators=(',', ': ')))
python
def download_json(local_filename, url, clobber=False): """Download the given JSON file, and pretty-print before we output it.""" with open(local_filename, 'w') as json_file: json_file.write(json.dumps(requests.get(url).json(), sort_keys=True, indent=2, separators=(',', ': ')))
[ "def", "download_json", "(", "local_filename", ",", "url", ",", "clobber", "=", "False", ")", ":", "with", "open", "(", "local_filename", ",", "'w'", ")", "as", "json_file", ":", "json_file", ".", "write", "(", "json", ".", "dumps", "(", "requests", ".",...
Download the given JSON file, and pretty-print before we output it.
[ "Download", "the", "given", "JSON", "file", "and", "pretty", "-", "print", "before", "we", "output", "it", "." ]
88e4866d73853e1025e549fbbe9744e750522359
https://github.com/bibanon/BASC-py4chan/blob/88e4866d73853e1025e549fbbe9744e750522359/examples/example6-download-thread.py#L35-L38
train
62,344
pkgw/pwkit
pwkit/data_gui_helpers.py
data_to_argb32
def data_to_argb32 (data, cmin=None, cmax=None, stretch='linear', cmap='black_to_blue'): """Turn arbitrary data values into ARGB32 colors. There are three steps to this process: clipping the data values to a maximum and minimum; stretching the spacing between those values; and converting their amplitud...
python
def data_to_argb32 (data, cmin=None, cmax=None, stretch='linear', cmap='black_to_blue'): """Turn arbitrary data values into ARGB32 colors. There are three steps to this process: clipping the data values to a maximum and minimum; stretching the spacing between those values; and converting their amplitud...
[ "def", "data_to_argb32", "(", "data", ",", "cmin", "=", "None", ",", "cmax", "=", "None", ",", "stretch", "=", "'linear'", ",", "cmap", "=", "'black_to_blue'", ")", ":", "# This could be more efficient, but whatever. This lets us share code with", "# the ndshow module."...
Turn arbitrary data values into ARGB32 colors. There are three steps to this process: clipping the data values to a maximum and minimum; stretching the spacing between those values; and converting their amplitudes into colors with some kind of color map. `data` - Input data; can (and should) be a M...
[ "Turn", "arbitrary", "data", "values", "into", "ARGB32", "colors", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/data_gui_helpers.py#L217-L261
train
62,345
pkgw/pwkit
pwkit/data_gui_helpers.py
data_to_imagesurface
def data_to_imagesurface (data, **kwargs): """Turn arbitrary data values into a Cairo ImageSurface. The method and arguments are the same as data_to_argb32, except that the data array will be treated as 2D, and higher dimensionalities are not allowed. The return value is a Cairo ImageSurface object. ...
python
def data_to_imagesurface (data, **kwargs): """Turn arbitrary data values into a Cairo ImageSurface. The method and arguments are the same as data_to_argb32, except that the data array will be treated as 2D, and higher dimensionalities are not allowed. The return value is a Cairo ImageSurface object. ...
[ "def", "data_to_imagesurface", "(", "data", ",", "*", "*", "kwargs", ")", ":", "import", "cairo", "data", "=", "np", ".", "atleast_2d", "(", "data", ")", "if", "data", ".", "ndim", "!=", "2", ":", "raise", "ValueError", "(", "'input array may not have more...
Turn arbitrary data values into a Cairo ImageSurface. The method and arguments are the same as data_to_argb32, except that the data array will be treated as 2D, and higher dimensionalities are not allowed. The return value is a Cairo ImageSurface object. Combined with the write_to_png() method on Imag...
[ "Turn", "arbitrary", "data", "values", "into", "a", "Cairo", "ImageSurface", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/data_gui_helpers.py#L264-L291
train
62,346
ferittuncer/ITU-Turkish-NLP-Pipeline-Caller
pipeline_caller.py
get_token
def get_token(filename=TOKEN_PATH, envvar=TOKEN_ENVVAR): """ Returns pipeline_token for API Tries local file first, then env variable """ if os.path.isfile(filename): with open(filename) as token_file: token = token_file.readline().strip() else: token = os.environ.g...
python
def get_token(filename=TOKEN_PATH, envvar=TOKEN_ENVVAR): """ Returns pipeline_token for API Tries local file first, then env variable """ if os.path.isfile(filename): with open(filename) as token_file: token = token_file.readline().strip() else: token = os.environ.g...
[ "def", "get_token", "(", "filename", "=", "TOKEN_PATH", ",", "envvar", "=", "TOKEN_ENVVAR", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "filename", ")", ":", "with", "open", "(", "filename", ")", "as", "token_file", ":", "token", "=", "token...
Returns pipeline_token for API Tries local file first, then env variable
[ "Returns", "pipeline_token", "for", "API" ]
602ee50d2b6f6e9937192b6a03ce91907a04f3d2
https://github.com/ferittuncer/ITU-Turkish-NLP-Pipeline-Caller/blob/602ee50d2b6f6e9937192b6a03ce91907a04f3d2/pipeline_caller.py#L103-L120
train
62,347
pkgw/pwkit
pwkit/environments/casa/gpdiagnostics.py
GainCal.stats
def stats (self, antnames): """XXX may be out of date.""" nbyant = np.zeros (self.nants, dtype=np.int) sum = np.zeros (self.nants, dtype=np.complex) sumsq = np.zeros (self.nants) q = np.abs (self.normvis - 1) for i in range (self.nsamps): i1, i2 = self.blidxs...
python
def stats (self, antnames): """XXX may be out of date.""" nbyant = np.zeros (self.nants, dtype=np.int) sum = np.zeros (self.nants, dtype=np.complex) sumsq = np.zeros (self.nants) q = np.abs (self.normvis - 1) for i in range (self.nsamps): i1, i2 = self.blidxs...
[ "def", "stats", "(", "self", ",", "antnames", ")", ":", "nbyant", "=", "np", ".", "zeros", "(", "self", ".", "nants", ",", "dtype", "=", "np", ".", "int", ")", "sum", "=", "np", ".", "zeros", "(", "self", ".", "nants", ",", "dtype", "=", "np", ...
XXX may be out of date.
[ "XXX", "may", "be", "out", "of", "date", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/environments/casa/gpdiagnostics.py#L220-L243
train
62,348
pkgw/pwkit
pwkit/lmmin.py
_qr_factor_packed
def _qr_factor_packed(a, enorm, finfo): """Compute the packed pivoting Q-R factorization of a matrix. Parameters: a - An n-by-m matrix, m >= n. This will be *overwritten* by this function as described below! enorm - A Euclidian-norm-computing function. finfo - A Numpy finfo object. Returns: pmut - A...
python
def _qr_factor_packed(a, enorm, finfo): """Compute the packed pivoting Q-R factorization of a matrix. Parameters: a - An n-by-m matrix, m >= n. This will be *overwritten* by this function as described below! enorm - A Euclidian-norm-computing function. finfo - A Numpy finfo object. Returns: pmut - A...
[ "def", "_qr_factor_packed", "(", "a", ",", "enorm", ",", "finfo", ")", ":", "machep", "=", "finfo", ".", "eps", "n", ",", "m", "=", "a", ".", "shape", "if", "m", "<", "n", ":", "raise", "ValueError", "(", "'\"a\" must be at least as tall as it is wide'", ...
Compute the packed pivoting Q-R factorization of a matrix. Parameters: a - An n-by-m matrix, m >= n. This will be *overwritten* by this function as described below! enorm - A Euclidian-norm-computing function. finfo - A Numpy finfo object. Returns: pmut - An n-element permutation vector rdiag - An n-el...
[ "Compute", "the", "packed", "pivoting", "Q", "-", "R", "factorization", "of", "a", "matrix", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/lmmin.py#L355-L477
train
62,349
pkgw/pwkit
pwkit/lmmin.py
_qr_factor_full
def _qr_factor_full(a, dtype=np.float): """Compute the QR factorization of a matrix, with pivoting. Parameters: a - An n-by-m arraylike, m >= n. dtype - (optional) The data type to use for computations. Default is np.float. Returns: q - An m-by-m orthogonal matrix (q q^T = ident) r - An n-by-m u...
python
def _qr_factor_full(a, dtype=np.float): """Compute the QR factorization of a matrix, with pivoting. Parameters: a - An n-by-m arraylike, m >= n. dtype - (optional) The data type to use for computations. Default is np.float. Returns: q - An m-by-m orthogonal matrix (q q^T = ident) r - An n-by-m u...
[ "def", "_qr_factor_full", "(", "a", ",", "dtype", "=", "np", ".", "float", ")", ":", "n", ",", "m", "=", "a", ".", "shape", "# Compute the packed Q and R matrix information.", "packed", ",", "pmut", ",", "rdiag", ",", "acnorm", "=", "_manual_qr_factor_packed",...
Compute the QR factorization of a matrix, with pivoting. Parameters: a - An n-by-m arraylike, m >= n. dtype - (optional) The data type to use for computations. Default is np.float. Returns: q - An m-by-m orthogonal matrix (q q^T = ident) r - An n-by-m upper triangular matrix pmut - An n-element perm...
[ "Compute", "the", "QR", "factorization", "of", "a", "matrix", "with", "pivoting", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/lmmin.py#L490-L549
train
62,350
pkgw/pwkit
pwkit/lmmin.py
_qrd_solve
def _qrd_solve(r, pmut, ddiag, bqt, sdiag): """Solve an equation given a QR factored matrix and a diagonal. Parameters: r - **input-output** n-by-n array. The full lower triangle contains the full lower triangle of R. On output, the strict upper triangle contains the transpose of the strict low...
python
def _qrd_solve(r, pmut, ddiag, bqt, sdiag): """Solve an equation given a QR factored matrix and a diagonal. Parameters: r - **input-output** n-by-n array. The full lower triangle contains the full lower triangle of R. On output, the strict upper triangle contains the transpose of the strict low...
[ "def", "_qrd_solve", "(", "r", ",", "pmut", ",", "ddiag", ",", "bqt", ",", "sdiag", ")", ":", "n", ",", "m", "=", "r", ".", "shape", "# \"Copy r and bqt to preserve input and initialize s. In", "# particular, save the diagonal elements of r in x.\" Recall that", "# on...
Solve an equation given a QR factored matrix and a diagonal. Parameters: r - **input-output** n-by-n array. The full lower triangle contains the full lower triangle of R. On output, the strict upper triangle contains the transpose of the strict lower triangle of S. pmut - n-vector describi...
[ "Solve", "an", "equation", "given", "a", "QR", "factored", "matrix", "and", "a", "diagonal", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/lmmin.py#L615-L747
train
62,351
pkgw/pwkit
pwkit/lmmin.py
_qrd_solve_full
def _qrd_solve_full(a, b, ddiag, dtype=np.float): """Solve the equation A^T x = B, D x = 0. Parameters: a - an n-by-m array, m >= n b - an m-vector ddiag - an n-vector giving the diagonal of D. (The rest of D is 0.) Returns: x - n-vector solving the equation. s - the n-by-n supplementary matrix s. p...
python
def _qrd_solve_full(a, b, ddiag, dtype=np.float): """Solve the equation A^T x = B, D x = 0. Parameters: a - an n-by-m array, m >= n b - an m-vector ddiag - an n-vector giving the diagonal of D. (The rest of D is 0.) Returns: x - n-vector solving the equation. s - the n-by-n supplementary matrix s. p...
[ "def", "_qrd_solve_full", "(", "a", ",", "b", ",", "ddiag", ",", "dtype", "=", "np", ".", "float", ")", ":", "a", "=", "np", ".", "asarray", "(", "a", ",", "dtype", ")", "b", "=", "np", ".", "asarray", "(", "b", ",", "dtype", ")", "ddiag", "=...
Solve the equation A^T x = B, D x = 0. Parameters: a - an n-by-m array, m >= n b - an m-vector ddiag - an n-vector giving the diagonal of D. (The rest of D is 0.) Returns: x - n-vector solving the equation. s - the n-by-n supplementary matrix s. pmut - n-element permutation vector defining the permutati...
[ "Solve", "the", "equation", "A^T", "x", "=", "B", "D", "x", "=", "0", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/lmmin.py#L774-L815
train
62,352
pkgw/pwkit
pwkit/lmmin.py
_calc_covariance
def _calc_covariance(r, pmut, tol=1e-14): """Calculate the covariance matrix of the fitted parameters Parameters: r - n-by-n matrix, the full upper triangle of R pmut - n-vector, defines the permutation of R tol - scalar, relative column scale for determining rank deficiency. Default 1e-14. Returns: co...
python
def _calc_covariance(r, pmut, tol=1e-14): """Calculate the covariance matrix of the fitted parameters Parameters: r - n-by-n matrix, the full upper triangle of R pmut - n-vector, defines the permutation of R tol - scalar, relative column scale for determining rank deficiency. Default 1e-14. Returns: co...
[ "def", "_calc_covariance", "(", "r", ",", "pmut", ",", "tol", "=", "1e-14", ")", ":", "# This routine could save an allocation by operating on r in-place,", "# which might be worthwhile for large n, and is what the original", "# Fortran does.", "n", "=", "r", ".", "shape", "[...
Calculate the covariance matrix of the fitted parameters Parameters: r - n-by-n matrix, the full upper triangle of R pmut - n-vector, defines the permutation of R tol - scalar, relative column scale for determining rank deficiency. Default 1e-14. Returns: cov - n-by-n matrix, the covariance matrix C Give...
[ "Calculate", "the", "covariance", "matrix", "of", "the", "fitted", "parameters" ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/lmmin.py#L1064-L1162
train
62,353
pkgw/pwkit
pwkit/cli/multitool.py
invoke_tool
def invoke_tool (namespace, tool_class=None): """Invoke a tool and exit. `namespace` is a namespace-type dict from which the tool is initialized. It should contain exactly one value that is a `Multitool` subclass, and this subclass will be instantiated and populated (see `Multitool.populate()`) usi...
python
def invoke_tool (namespace, tool_class=None): """Invoke a tool and exit. `namespace` is a namespace-type dict from which the tool is initialized. It should contain exactly one value that is a `Multitool` subclass, and this subclass will be instantiated and populated (see `Multitool.populate()`) usi...
[ "def", "invoke_tool", "(", "namespace", ",", "tool_class", "=", "None", ")", ":", "import", "sys", "from", ".", ".", "import", "cli", "cli", ".", "propagate_sigint", "(", ")", "cli", ".", "unicode_stdio", "(", ")", "cli", ".", "backtrace_on_usr1", "(", "...
Invoke a tool and exit. `namespace` is a namespace-type dict from which the tool is initialized. It should contain exactly one value that is a `Multitool` subclass, and this subclass will be instantiated and populated (see `Multitool.populate()`) using the other items in the namespace. Instances an...
[ "Invoke", "a", "tool", "and", "exit", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/cli/multitool.py#L361-L404
train
62,354
pkgw/pwkit
pwkit/cli/multitool.py
ArgparsingCommand.get_arg_parser
def get_arg_parser (self, **kwargs): """Return an instance of `argparse.ArgumentParser` used to process this tool's command-line arguments. """ import argparse ap = argparse.ArgumentParser ( prog = kwargs['argv0'], description = self.summary, ) ...
python
def get_arg_parser (self, **kwargs): """Return an instance of `argparse.ArgumentParser` used to process this tool's command-line arguments. """ import argparse ap = argparse.ArgumentParser ( prog = kwargs['argv0'], description = self.summary, ) ...
[ "def", "get_arg_parser", "(", "self", ",", "*", "*", "kwargs", ")", ":", "import", "argparse", "ap", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "kwargs", "[", "'argv0'", "]", ",", "description", "=", "self", ".", "summary", ",", ")", "re...
Return an instance of `argparse.ArgumentParser` used to process this tool's command-line arguments.
[ "Return", "an", "instance", "of", "argparse", ".", "ArgumentParser", "used", "to", "process", "this", "tool", "s", "command", "-", "line", "arguments", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/cli/multitool.py#L165-L175
train
62,355
pkgw/pwkit
pwkit/cli/multitool.py
DelegatingCommand.register
def register (self, cmd): """Register a new command with the tool. 'cmd' is expected to be an instance of `Command`, although here only the `cmd.name` attribute is investigated. Multiple commands with the same name are not allowed to be registered. Returns 'self'. """ if...
python
def register (self, cmd): """Register a new command with the tool. 'cmd' is expected to be an instance of `Command`, although here only the `cmd.name` attribute is investigated. Multiple commands with the same name are not allowed to be registered. Returns 'self'. """ if...
[ "def", "register", "(", "self", ",", "cmd", ")", ":", "if", "cmd", ".", "name", "is", "None", ":", "raise", "ValueError", "(", "'no name set for Command object %r'", "%", "cmd", ")", "if", "cmd", ".", "name", "in", "self", ".", "commands", ":", "raise", ...
Register a new command with the tool. 'cmd' is expected to be an instance of `Command`, although here only the `cmd.name` attribute is investigated. Multiple commands with the same name are not allowed to be registered. Returns 'self'.
[ "Register", "a", "new", "command", "with", "the", "tool", ".", "cmd", "is", "expected", "to", "be", "an", "instance", "of", "Command", "although", "here", "only", "the", "cmd", ".", "name", "attribute", "is", "investigated", ".", "Multiple", "commands", "w...
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/cli/multitool.py#L243-L257
train
62,356
pkgw/pwkit
pwkit/cli/multitool.py
DelegatingCommand.invoke_command
def invoke_command (self, cmd, args, **kwargs): """This function mainly exists to be overridden by subclasses.""" new_kwargs = kwargs.copy () new_kwargs['argv0'] = kwargs['argv0'] + ' ' + cmd.name new_kwargs['parent'] = self new_kwargs['parent_kwargs'] = kwargs return cmd...
python
def invoke_command (self, cmd, args, **kwargs): """This function mainly exists to be overridden by subclasses.""" new_kwargs = kwargs.copy () new_kwargs['argv0'] = kwargs['argv0'] + ' ' + cmd.name new_kwargs['parent'] = self new_kwargs['parent_kwargs'] = kwargs return cmd...
[ "def", "invoke_command", "(", "self", ",", "cmd", ",", "args", ",", "*", "*", "kwargs", ")", ":", "new_kwargs", "=", "kwargs", ".", "copy", "(", ")", "new_kwargs", "[", "'argv0'", "]", "=", "kwargs", "[", "'argv0'", "]", "+", "' '", "+", "cmd", "."...
This function mainly exists to be overridden by subclasses.
[ "This", "function", "mainly", "exists", "to", "be", "overridden", "by", "subclasses", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/cli/multitool.py#L277-L283
train
62,357
pkgw/pwkit
pwkit/cli/latexdriver.py
merge_bibtex_collections
def merge_bibtex_collections(citednames, maindict, extradicts, allow_missing=False): """There must be a way to be efficient and stream output instead of loading everything into memory at once, but, meh. Note that we augment `citednames` with all of the names in `maindict`. The intention is that if we'v...
python
def merge_bibtex_collections(citednames, maindict, extradicts, allow_missing=False): """There must be a way to be efficient and stream output instead of loading everything into memory at once, but, meh. Note that we augment `citednames` with all of the names in `maindict`. The intention is that if we'v...
[ "def", "merge_bibtex_collections", "(", "citednames", ",", "maindict", ",", "extradicts", ",", "allow_missing", "=", "False", ")", ":", "allrecords", "=", "{", "}", "for", "ed", "in", "extradicts", ":", "allrecords", ".", "update", "(", "ed", ")", "allrecord...
There must be a way to be efficient and stream output instead of loading everything into memory at once, but, meh. Note that we augment `citednames` with all of the names in `maindict`. The intention is that if we've gone to the effort of getting good data for some record, we don't want to trash it if ...
[ "There", "must", "be", "a", "way", "to", "be", "efficient", "and", "stream", "output", "instead", "of", "loading", "everything", "into", "memory", "at", "once", "but", "meh", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/cli/latexdriver.py#L52-L89
train
62,358
pkgw/pwkit
pwkit/cli/latexdriver.py
write_bibtex_dict
def write_bibtex_dict(stream, entries): """bibtexparser.write converts the entire database to one big string and writes it out in one go. I'm sure it will always all fit in RAM but some things just will not stand. """ from bibtexparser.bwriter import BibTexWriter writer = BibTexWriter() wr...
python
def write_bibtex_dict(stream, entries): """bibtexparser.write converts the entire database to one big string and writes it out in one go. I'm sure it will always all fit in RAM but some things just will not stand. """ from bibtexparser.bwriter import BibTexWriter writer = BibTexWriter() wr...
[ "def", "write_bibtex_dict", "(", "stream", ",", "entries", ")", ":", "from", "bibtexparser", ".", "bwriter", "import", "BibTexWriter", "writer", "=", "BibTexWriter", "(", ")", "writer", ".", "indent", "=", "' '", "writer", ".", "entry_separator", "=", "''", ...
bibtexparser.write converts the entire database to one big string and writes it out in one go. I'm sure it will always all fit in RAM but some things just will not stand.
[ "bibtexparser", ".", "write", "converts", "the", "entire", "database", "to", "one", "big", "string", "and", "writes", "it", "out", "in", "one", "go", ".", "I", "m", "sure", "it", "will", "always", "all", "fit", "in", "RAM", "but", "some", "things", "ju...
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/cli/latexdriver.py#L105-L123
train
62,359
pkgw/pwkit
pwkit/cli/latexdriver.py
merge_bibtex_with_aux
def merge_bibtex_with_aux(auxpath, mainpath, extradir, parse=get_bibtex_dict, allow_missing=False): """Merge multiple BibTeX files into a single homogeneously-formatted output, using a LaTeX .aux file to know which records are worth paying attention to. The file identified by `mainpath` will be overwri...
python
def merge_bibtex_with_aux(auxpath, mainpath, extradir, parse=get_bibtex_dict, allow_missing=False): """Merge multiple BibTeX files into a single homogeneously-formatted output, using a LaTeX .aux file to know which records are worth paying attention to. The file identified by `mainpath` will be overwri...
[ "def", "merge_bibtex_with_aux", "(", "auxpath", ",", "mainpath", ",", "extradir", ",", "parse", "=", "get_bibtex_dict", ",", "allow_missing", "=", "False", ")", ":", "auxpath", "=", "Path", "(", "auxpath", ")", "mainpath", "=", "Path", "(", "mainpath", ")", ...
Merge multiple BibTeX files into a single homogeneously-formatted output, using a LaTeX .aux file to know which records are worth paying attention to. The file identified by `mainpath` will be overwritten with the new .bib contents. This function is intended to be used in a version-control context....
[ "Merge", "multiple", "BibTeX", "files", "into", "a", "single", "homogeneously", "-", "formatted", "output", "using", "a", "LaTeX", ".", "aux", "file", "to", "know", "which", "records", "are", "worth", "paying", "attention", "to", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/cli/latexdriver.py#L126-L165
train
62,360
pkgw/pwkit
pwkit/cli/latexdriver.py
just_smart_bibtools
def just_smart_bibtools(bib_style, aux, bib): """Tectonic has taken over most of the features that this tool used to provide, but here's a hack to keep my smart .bib file generation working. """ extradir = Path('.bibtex') extradir.ensure_dir(parents=True) bib_export(bib_style, aux, extradir / ...
python
def just_smart_bibtools(bib_style, aux, bib): """Tectonic has taken over most of the features that this tool used to provide, but here's a hack to keep my smart .bib file generation working. """ extradir = Path('.bibtex') extradir.ensure_dir(parents=True) bib_export(bib_style, aux, extradir / ...
[ "def", "just_smart_bibtools", "(", "bib_style", ",", "aux", ",", "bib", ")", ":", "extradir", "=", "Path", "(", "'.bibtex'", ")", "extradir", ".", "ensure_dir", "(", "parents", "=", "True", ")", "bib_export", "(", "bib_style", ",", "aux", ",", "extradir", ...
Tectonic has taken over most of the features that this tool used to provide, but here's a hack to keep my smart .bib file generation working.
[ "Tectonic", "has", "taken", "over", "most", "of", "the", "features", "that", "this", "tool", "used", "to", "provide", "but", "here", "s", "a", "hack", "to", "keep", "my", "smart", ".", "bib", "file", "generation", "working", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/cli/latexdriver.py#L319-L329
train
62,361
pkgw/pwkit
pwkit/environments/casa/closures.py
aap_to_bp
def aap_to_bp (ant1, ant2, pol): """Create a basepol from antenna numbers and a CASA polarization code.""" if ant1 < 0: raise ValueError ('first antenna is below 0: %s' % ant1) if ant2 < ant1: raise ValueError ('second antenna is below first: %s' % ant2) if pol < 1 or pol > 12: ...
python
def aap_to_bp (ant1, ant2, pol): """Create a basepol from antenna numbers and a CASA polarization code.""" if ant1 < 0: raise ValueError ('first antenna is below 0: %s' % ant1) if ant2 < ant1: raise ValueError ('second antenna is below first: %s' % ant2) if pol < 1 or pol > 12: ...
[ "def", "aap_to_bp", "(", "ant1", ",", "ant2", ",", "pol", ")", ":", "if", "ant1", "<", "0", ":", "raise", "ValueError", "(", "'first antenna is below 0: %s'", "%", "ant1", ")", "if", "ant2", "<", "ant1", ":", "raise", "ValueError", "(", "'second antenna is...
Create a basepol from antenna numbers and a CASA polarization code.
[ "Create", "a", "basepol", "from", "antenna", "numbers", "and", "a", "CASA", "polarization", "code", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/environments/casa/closures.py#L168-L181
train
62,362
pkgw/pwkit
pwkit/environments/casa/closures.py
ClosureCalculator._finish_timeslot
def _finish_timeslot (self): """We have loaded in all of the visibilities in one timeslot. We can now compute the phase closure triples. XXX: we should only process independent triples. Are we??? """ for fpol, aps in self.ap_by_fpol.items (): aps = sorted (aps) ...
python
def _finish_timeslot (self): """We have loaded in all of the visibilities in one timeslot. We can now compute the phase closure triples. XXX: we should only process independent triples. Are we??? """ for fpol, aps in self.ap_by_fpol.items (): aps = sorted (aps) ...
[ "def", "_finish_timeslot", "(", "self", ")", ":", "for", "fpol", ",", "aps", "in", "self", ".", "ap_by_fpol", ".", "items", "(", ")", ":", "aps", "=", "sorted", "(", "aps", ")", "nap", "=", "len", "(", "aps", ")", "for", "i1", ",", "ap1", "in", ...
We have loaded in all of the visibilities in one timeslot. We can now compute the phase closure triples. XXX: we should only process independent triples. Are we???
[ "We", "have", "loaded", "in", "all", "of", "the", "visibilities", "in", "one", "timeslot", ".", "We", "can", "now", "compute", "the", "phase", "closure", "triples", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/environments/casa/closures.py#L699-L750
train
62,363
pkgw/pwkit
pwkit/environments/casa/closures.py
ClosureCalculator._process_sample
def _process_sample (self, ap1, ap2, ap3, triple, tflags): """We have computed one independent phase closure triple in one timeslot. """ # Frequency-resolved: np.divide (triple, np.abs (triple), triple) phase = np.angle (triple) self.ap_spec_stats_by_ddid[self.cur_ddid]...
python
def _process_sample (self, ap1, ap2, ap3, triple, tflags): """We have computed one independent phase closure triple in one timeslot. """ # Frequency-resolved: np.divide (triple, np.abs (triple), triple) phase = np.angle (triple) self.ap_spec_stats_by_ddid[self.cur_ddid]...
[ "def", "_process_sample", "(", "self", ",", "ap1", ",", "ap2", ",", "ap3", ",", "triple", ",", "tflags", ")", ":", "# Frequency-resolved:", "np", ".", "divide", "(", "triple", ",", "np", ".", "abs", "(", "triple", ")", ",", "triple", ")", "phase", "=...
We have computed one independent phase closure triple in one timeslot.
[ "We", "have", "computed", "one", "independent", "phase", "closure", "triple", "in", "one", "timeslot", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/environments/casa/closures.py#L753-L780
train
62,364
pkgw/pwkit
pwkit/phoenix.py
load_spectrum
def load_spectrum(path, smoothing=181, DF=-8.): """Load a Phoenix model atmosphere spectrum. path : string The file path to load. smoothing : integer Smoothing to apply. If None, do not smooth. If an integer, smooth with a Hamming window. Otherwise, the variable is assumed to be a differe...
python
def load_spectrum(path, smoothing=181, DF=-8.): """Load a Phoenix model atmosphere spectrum. path : string The file path to load. smoothing : integer Smoothing to apply. If None, do not smooth. If an integer, smooth with a Hamming window. Otherwise, the variable is assumed to be a differe...
[ "def", "load_spectrum", "(", "path", ",", "smoothing", "=", "181", ",", "DF", "=", "-", "8.", ")", ":", "try", ":", "ang", ",", "lflam", "=", "np", ".", "loadtxt", "(", "path", ",", "usecols", "=", "(", "0", ",", "1", ")", ")", ".", "T", "exc...
Load a Phoenix model atmosphere spectrum. path : string The file path to load. smoothing : integer Smoothing to apply. If None, do not smooth. If an integer, smooth with a Hamming window. Otherwise, the variable is assumed to be a different smoothing window, and the data will be convolv...
[ "Load", "a", "Phoenix", "model", "atmosphere", "spectrum", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/phoenix.py#L44-L103
train
62,365
pkgw/pwkit
pwkit/ucd_physics.py
lbol_from_spt_dist_mag
def lbol_from_spt_dist_mag (sptnum, dist_pc, jmag, kmag, format='cgs'): """Estimate a UCD's bolometric luminosity given some basic parameters. sptnum: the spectral type as a number; 8 -> M8; 10 -> L0 ; 20 -> T0 Valid values range between 0 and 30, ie M0 to Y0. dist_pc: distance to the object in parse...
python
def lbol_from_spt_dist_mag (sptnum, dist_pc, jmag, kmag, format='cgs'): """Estimate a UCD's bolometric luminosity given some basic parameters. sptnum: the spectral type as a number; 8 -> M8; 10 -> L0 ; 20 -> T0 Valid values range between 0 and 30, ie M0 to Y0. dist_pc: distance to the object in parse...
[ "def", "lbol_from_spt_dist_mag", "(", "sptnum", ",", "dist_pc", ",", "jmag", ",", "kmag", ",", "format", "=", "'cgs'", ")", ":", "bcj", "=", "bcj_from_spt", "(", "sptnum", ")", "bck", "=", "bck_from_spt", "(", "sptnum", ")", "n", "=", "np", ".", "zeros...
Estimate a UCD's bolometric luminosity given some basic parameters. sptnum: the spectral type as a number; 8 -> M8; 10 -> L0 ; 20 -> T0 Valid values range between 0 and 30, ie M0 to Y0. dist_pc: distance to the object in parsecs jmag: object's J-band magnitude or NaN (*not* None) if unavailable k...
[ "Estimate", "a", "UCD", "s", "bolometric", "luminosity", "given", "some", "basic", "parameters", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/ucd_physics.py#L129-L167
train
62,366
pkgw/pwkit
pwkit/parallel.py
InterruptiblePool.map
def map(self, func, iterable, chunksize=None): """Equivalent of `map` built-in, without swallowing KeyboardInterrupt. func The function to apply to the items. iterable An iterable of items that will have `func` applied to them. """ # The key magic is that we...
python
def map(self, func, iterable, chunksize=None): """Equivalent of `map` built-in, without swallowing KeyboardInterrupt. func The function to apply to the items. iterable An iterable of items that will have `func` applied to them. """ # The key magic is that we...
[ "def", "map", "(", "self", ",", "func", ",", "iterable", ",", "chunksize", "=", "None", ")", ":", "# The key magic is that we must call r.get() with a timeout, because a", "# Condition.wait() without a timeout swallows KeyboardInterrupts.", "r", "=", "self", ".", "map_async",...
Equivalent of `map` built-in, without swallowing KeyboardInterrupt. func The function to apply to the items. iterable An iterable of items that will have `func` applied to them.
[ "Equivalent", "of", "map", "built", "-", "in", "without", "swallowing", "KeyboardInterrupt", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/parallel.py#L107-L128
train
62,367
pkgw/pwkit
pwkit/astutil.py
fmthours
def fmthours (radians, norm='wrap', precision=3, seps='::'): """Format an angle as sexagesimal hours in a string. Arguments are: radians The angle, in radians. norm (default "wrap") The normalization mode, used for angles outside of the standard range of 0 to 2π. If "none", the value...
python
def fmthours (radians, norm='wrap', precision=3, seps='::'): """Format an angle as sexagesimal hours in a string. Arguments are: radians The angle, in radians. norm (default "wrap") The normalization mode, used for angles outside of the standard range of 0 to 2π. If "none", the value...
[ "def", "fmthours", "(", "radians", ",", "norm", "=", "'wrap'", ",", "precision", "=", "3", ",", "seps", "=", "'::'", ")", ":", "return", "_fmtsexagesimal", "(", "radians", "*", "R2H", ",", "norm", ",", "24", ",", "seps", ",", "precision", "=", "preci...
Format an angle as sexagesimal hours in a string. Arguments are: radians The angle, in radians. norm (default "wrap") The normalization mode, used for angles outside of the standard range of 0 to 2π. If "none", the value is formatted ignoring any potential problems. If "wrap", it i...
[ "Format", "an", "angle", "as", "sexagesimal", "hours", "in", "a", "string", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/astutil.py#L114-L138
train
62,368
pkgw/pwkit
pwkit/astutil.py
fmtdeglon
def fmtdeglon (radians, norm='wrap', precision=2, seps='::'): """Format a longitudinal angle as sexagesimal degrees in a string. Arguments are: radians The angle, in radians. norm (default "wrap") The normalization mode, used for angles outside of the standard range of 0 to 2π. If "n...
python
def fmtdeglon (radians, norm='wrap', precision=2, seps='::'): """Format a longitudinal angle as sexagesimal degrees in a string. Arguments are: radians The angle, in radians. norm (default "wrap") The normalization mode, used for angles outside of the standard range of 0 to 2π. If "n...
[ "def", "fmtdeglon", "(", "radians", ",", "norm", "=", "'wrap'", ",", "precision", "=", "2", ",", "seps", "=", "'::'", ")", ":", "return", "_fmtsexagesimal", "(", "radians", "*", "R2D", ",", "norm", ",", "360", ",", "seps", ",", "precision", "=", "pre...
Format a longitudinal angle as sexagesimal degrees in a string. Arguments are: radians The angle, in radians. norm (default "wrap") The normalization mode, used for angles outside of the standard range of 0 to 2π. If "none", the value is formatted ignoring any potential problems. I...
[ "Format", "a", "longitudinal", "angle", "as", "sexagesimal", "degrees", "in", "a", "string", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/astutil.py#L141-L165
train
62,369
pkgw/pwkit
pwkit/astutil.py
fmtdeglat
def fmtdeglat (radians, norm='raise', precision=2, seps='::'): """Format a latitudinal angle as sexagesimal degrees in a string. Arguments are: radians The angle, in radians. norm (default "raise") The normalization mode, used for angles outside of the standard range of -π/2 to π/2. ...
python
def fmtdeglat (radians, norm='raise', precision=2, seps='::'): """Format a latitudinal angle as sexagesimal degrees in a string. Arguments are: radians The angle, in radians. norm (default "raise") The normalization mode, used for angles outside of the standard range of -π/2 to π/2. ...
[ "def", "fmtdeglat", "(", "radians", ",", "norm", "=", "'raise'", ",", "precision", "=", "2", ",", "seps", "=", "'::'", ")", ":", "if", "norm", "==", "'none'", ":", "pass", "elif", "norm", "==", "'raise'", ":", "if", "radians", ">", "halfpi", "or", ...
Format a latitudinal angle as sexagesimal degrees in a string. Arguments are: radians The angle, in radians. norm (default "raise") The normalization mode, used for angles outside of the standard range of -π/2 to π/2. If "none", the value is formatted ignoring any potential problem...
[ "Format", "a", "latitudinal", "angle", "as", "sexagesimal", "degrees", "in", "a", "string", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/astutil.py#L168-L247
train
62,370
pkgw/pwkit
pwkit/astutil.py
fmtradec
def fmtradec (rarad, decrad, precision=2, raseps='::', decseps='::', intersep=' '): """Format equatorial coordinates in a single sexagesimal string. Returns a string of the RA/lon coordinate, formatted as sexagesimal hours, then *intersep*, then the Dec/lat coordinate, formatted as degrees. This yields...
python
def fmtradec (rarad, decrad, precision=2, raseps='::', decseps='::', intersep=' '): """Format equatorial coordinates in a single sexagesimal string. Returns a string of the RA/lon coordinate, formatted as sexagesimal hours, then *intersep*, then the Dec/lat coordinate, formatted as degrees. This yields...
[ "def", "fmtradec", "(", "rarad", ",", "decrad", ",", "precision", "=", "2", ",", "raseps", "=", "'::'", ",", "decseps", "=", "'::'", ",", "intersep", "=", "' '", ")", ":", "return", "(", "fmthours", "(", "rarad", ",", "precision", "=", "precision", "...
Format equatorial coordinates in a single sexagesimal string. Returns a string of the RA/lon coordinate, formatted as sexagesimal hours, then *intersep*, then the Dec/lat coordinate, formatted as degrees. This yields something like "12:34:56.78 -01:23:45.6". Arguments are: rarad The right ascens...
[ "Format", "equatorial", "coordinates", "in", "a", "single", "sexagesimal", "string", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/astutil.py#L250-L285
train
62,371
pkgw/pwkit
pwkit/astutil.py
parsehours
def parsehours (hrstr): """Parse a string formatted as sexagesimal hours into an angle. This function converts a textual representation of an angle, measured in hours, into a floating point value measured in radians. The format of *hrstr* is very limited: it may not have leading or trailing whitespace,...
python
def parsehours (hrstr): """Parse a string formatted as sexagesimal hours into an angle. This function converts a textual representation of an angle, measured in hours, into a floating point value measured in radians. The format of *hrstr* is very limited: it may not have leading or trailing whitespace,...
[ "def", "parsehours", "(", "hrstr", ")", ":", "hr", "=", "_parsesexagesimal", "(", "hrstr", ",", "'hours'", ",", "False", ")", "if", "hr", ">=", "24", ":", "raise", "ValueError", "(", "'illegal hour specification: '", "+", "hrstr", ")", "return", "hr", "*",...
Parse a string formatted as sexagesimal hours into an angle. This function converts a textual representation of an angle, measured in hours, into a floating point value measured in radians. The format of *hrstr* is very limited: it may not have leading or trailing whitespace, and the components of the ...
[ "Parse", "a", "string", "formatted", "as", "sexagesimal", "hours", "into", "an", "angle", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/astutil.py#L319-L335
train
62,372
pkgw/pwkit
pwkit/astutil.py
parsedeglat
def parsedeglat (latstr): """Parse a latitude formatted as sexagesimal degrees into an angle. This function converts a textual representation of a latitude, measured in degrees, into a floating point value measured in radians. The format of *latstr* is very limited: it may not have leading or trailing ...
python
def parsedeglat (latstr): """Parse a latitude formatted as sexagesimal degrees into an angle. This function converts a textual representation of a latitude, measured in degrees, into a floating point value measured in radians. The format of *latstr* is very limited: it may not have leading or trailing ...
[ "def", "parsedeglat", "(", "latstr", ")", ":", "deg", "=", "_parsesexagesimal", "(", "latstr", ",", "'latitude'", ",", "True", ")", "if", "abs", "(", "deg", ")", ">", "90", ":", "raise", "ValueError", "(", "'illegal latitude specification: '", "+", "latstr",...
Parse a latitude formatted as sexagesimal degrees into an angle. This function converts a textual representation of a latitude, measured in degrees, into a floating point value measured in radians. The format of *latstr* is very limited: it may not have leading or trailing whitespace, and the component...
[ "Parse", "a", "latitude", "formatted", "as", "sexagesimal", "degrees", "into", "an", "angle", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/astutil.py#L338-L354
train
62,373
pkgw/pwkit
pwkit/astutil.py
sphdist
def sphdist (lat1, lon1, lat2, lon2): """Calculate the distance between two locations on a sphere. lat1 The latitude of the first location. lon1 The longitude of the first location. lat2 The latitude of the second location. lon2 The longitude of the second location. Ret...
python
def sphdist (lat1, lon1, lat2, lon2): """Calculate the distance between two locations on a sphere. lat1 The latitude of the first location. lon1 The longitude of the first location. lat2 The latitude of the second location. lon2 The longitude of the second location. Ret...
[ "def", "sphdist", "(", "lat1", ",", "lon1", ",", "lat2", ",", "lon2", ")", ":", "cd", "=", "np", ".", "cos", "(", "lon2", "-", "lon1", ")", "sd", "=", "np", ".", "sin", "(", "lon2", "-", "lon1", ")", "c2", "=", "np", ".", "cos", "(", "lat2"...
Calculate the distance between two locations on a sphere. lat1 The latitude of the first location. lon1 The longitude of the first location. lat2 The latitude of the second location. lon2 The longitude of the second location. Returns the separation in radians. All arguments...
[ "Calculate", "the", "distance", "between", "two", "locations", "on", "a", "sphere", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/astutil.py#L376-L408
train
62,374
pkgw/pwkit
pwkit/astutil.py
sphbear
def sphbear (lat1, lon1, lat2, lon2, tol=1e-15): """Calculate the bearing between two locations on a sphere. lat1 The latitude of the first location. lon1 The longitude of the first location. lat2 The latitude of the second location. lon2 The longitude of the second location...
python
def sphbear (lat1, lon1, lat2, lon2, tol=1e-15): """Calculate the bearing between two locations on a sphere. lat1 The latitude of the first location. lon1 The longitude of the first location. lat2 The latitude of the second location. lon2 The longitude of the second location...
[ "def", "sphbear", "(", "lat1", ",", "lon1", ",", "lat2", ",", "lon2", ",", "tol", "=", "1e-15", ")", ":", "# cross product on outer axis:", "ocross", "=", "lambda", "a", ",", "b", ":", "np", ".", "cross", "(", "a", ",", "b", ",", "axisa", "=", "0",...
Calculate the bearing between two locations on a sphere. lat1 The latitude of the first location. lon1 The longitude of the first location. lat2 The latitude of the second location. lon2 The longitude of the second location. tol Tolerance for checking proximity to pole...
[ "Calculate", "the", "bearing", "between", "two", "locations", "on", "a", "sphere", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/astutil.py#L412-L471
train
62,375
pkgw/pwkit
pwkit/astutil.py
sphofs
def sphofs (lat1, lon1, r, pa, tol=1e-2, rmax=None): """Offset from one location on the sphere to another. This function is given a start location, expressed as a latitude and longitude, a distance to offset, and a direction to offset (expressed as a bearing, AKA position angle). It uses these to compu...
python
def sphofs (lat1, lon1, r, pa, tol=1e-2, rmax=None): """Offset from one location on the sphere to another. This function is given a start location, expressed as a latitude and longitude, a distance to offset, and a direction to offset (expressed as a bearing, AKA position angle). It uses these to compu...
[ "def", "sphofs", "(", "lat1", ",", "lon1", ",", "r", ",", "pa", ",", "tol", "=", "1e-2", ",", "rmax", "=", "None", ")", ":", "if", "rmax", "is", "not", "None", "and", "np", ".", "abs", "(", "r", ")", ">", "rmax", ":", "raise", "ValueError", "...
Offset from one location on the sphere to another. This function is given a start location, expressed as a latitude and longitude, a distance to offset, and a direction to offset (expressed as a bearing, AKA position angle). It uses these to compute a final location. This function mirrors :func:`sphdis...
[ "Offset", "from", "one", "location", "on", "the", "sphere", "to", "another", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/astutil.py#L474-L543
train
62,376
pkgw/pwkit
pwkit/astutil.py
parang
def parang (hourangle, declination, latitude): """Calculate the parallactic angle of a sky position. This computes the parallactic angle of a sky position expressed in terms of an hour angle and declination. Arguments: hourangle The hour angle of the location on the sky. declination Th...
python
def parang (hourangle, declination, latitude): """Calculate the parallactic angle of a sky position. This computes the parallactic angle of a sky position expressed in terms of an hour angle and declination. Arguments: hourangle The hour angle of the location on the sky. declination Th...
[ "def", "parang", "(", "hourangle", ",", "declination", ",", "latitude", ")", ":", "return", "-", "np", ".", "arctan2", "(", "-", "np", ".", "sin", "(", "hourangle", ")", ",", "np", ".", "cos", "(", "declination", ")", "*", "np", ".", "tan", "(", ...
Calculate the parallactic angle of a sky position. This computes the parallactic angle of a sky position expressed in terms of an hour angle and declination. Arguments: hourangle The hour angle of the location on the sky. declination The declination of the location on the sky. latitude...
[ "Calculate", "the", "parallactic", "angle", "of", "a", "sky", "position", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/astutil.py#L549-L568
train
62,377
pkgw/pwkit
pwkit/astutil.py
gaussian_convolve
def gaussian_convolve (maj1, min1, pa1, maj2, min2, pa2): """Convolve two Gaussians analytically. Given the shapes of two 2-dimensional Gaussians, this function returns the shape of their convolution. Arguments: maj1 Major axis of input Gaussian 1. min1 Minor axis of input Gaussia...
python
def gaussian_convolve (maj1, min1, pa1, maj2, min2, pa2): """Convolve two Gaussians analytically. Given the shapes of two 2-dimensional Gaussians, this function returns the shape of their convolution. Arguments: maj1 Major axis of input Gaussian 1. min1 Minor axis of input Gaussia...
[ "def", "gaussian_convolve", "(", "maj1", ",", "min1", ",", "pa1", ",", "maj2", ",", "min2", ",", "pa2", ")", ":", "c1", "=", "np", ".", "cos", "(", "pa1", ")", "s1", "=", "np", ".", "sin", "(", "pa1", ")", "c2", "=", "np", ".", "cos", "(", ...
Convolve two Gaussians analytically. Given the shapes of two 2-dimensional Gaussians, this function returns the shape of their convolution. Arguments: maj1 Major axis of input Gaussian 1. min1 Minor axis of input Gaussian 1. pa1 Orientation angle of input Gaussian 1, in radi...
[ "Convolve", "two", "Gaussians", "analytically", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/astutil.py#L573-L624
train
62,378
pkgw/pwkit
pwkit/astutil.py
gaussian_deconvolve
def gaussian_deconvolve (smaj, smin, spa, bmaj, bmin, bpa): """Deconvolve two Gaussians analytically. Given the shapes of 2-dimensional “source” and “beam” Gaussians, this returns a deconvolved “result” Gaussian such that the convolution of “beam” and “result” is “source”. Arguments: smaj ...
python
def gaussian_deconvolve (smaj, smin, spa, bmaj, bmin, bpa): """Deconvolve two Gaussians analytically. Given the shapes of 2-dimensional “source” and “beam” Gaussians, this returns a deconvolved “result” Gaussian such that the convolution of “beam” and “result” is “source”. Arguments: smaj ...
[ "def", "gaussian_deconvolve", "(", "smaj", ",", "smin", ",", "spa", ",", "bmaj", ",", "bmin", ",", "bpa", ")", ":", "# I've added extra code to ensure ``smaj >= bmaj``, ``smin >= bmin``, and", "# increased the coefficient in front of \"limit\" from 0.1 to 0.5. Feel a", "# little ...
Deconvolve two Gaussians analytically. Given the shapes of 2-dimensional “source” and “beam” Gaussians, this returns a deconvolved “result” Gaussian such that the convolution of “beam” and “result” is “source”. Arguments: smaj Major axis of source Gaussian. smin Minor axis of sour...
[ "Deconvolve", "two", "Gaussians", "analytically", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/astutil.py#L627-L710
train
62,379
pkgw/pwkit
pwkit/astutil.py
load_skyfield_data
def load_skyfield_data(): """Load data files used in Skyfield. This will download files from the internet if they haven't been downloaded before. Skyfield downloads files to the current directory by default, which is not ideal. Here we abuse astropy and use its cache directory to cache the data fil...
python
def load_skyfield_data(): """Load data files used in Skyfield. This will download files from the internet if they haven't been downloaded before. Skyfield downloads files to the current directory by default, which is not ideal. Here we abuse astropy and use its cache directory to cache the data fil...
[ "def", "load_skyfield_data", "(", ")", ":", "import", "os", ".", "path", "from", "astropy", ".", "config", "import", "paths", "from", "skyfield", ".", "api", "import", "Loader", "cache_dir", "=", "os", ".", "path", ".", "join", "(", "paths", ".", "get_ca...
Load data files used in Skyfield. This will download files from the internet if they haven't been downloaded before. Skyfield downloads files to the current directory by default, which is not ideal. Here we abuse astropy and use its cache directory to cache the data files per-user. If we start download...
[ "Load", "data", "files", "used", "in", "Skyfield", ".", "This", "will", "download", "files", "from", "the", "internet", "if", "they", "haven", "t", "been", "downloaded", "before", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/astutil.py#L718-L742
train
62,380
pkgw/pwkit
pwkit/astutil.py
get_2mass_epoch
def get_2mass_epoch (tmra, tmdec, debug=False): """Given a 2MASS position, look up the epoch when it was observed. This function uses the CDS Vizier web service to look up information in the 2MASS point source database. Arguments are: tmra The source's J2000 right ascension, in radians. tmde...
python
def get_2mass_epoch (tmra, tmdec, debug=False): """Given a 2MASS position, look up the epoch when it was observed. This function uses the CDS Vizier web service to look up information in the 2MASS point source database. Arguments are: tmra The source's J2000 right ascension, in radians. tmde...
[ "def", "get_2mass_epoch", "(", "tmra", ",", "tmdec", ",", "debug", "=", "False", ")", ":", "import", "codecs", "try", ":", "from", "urllib", ".", "request", "import", "urlopen", "except", "ImportError", ":", "from", "urllib2", "import", "urlopen", "postdata"...
Given a 2MASS position, look up the epoch when it was observed. This function uses the CDS Vizier web service to look up information in the 2MASS point source database. Arguments are: tmra The source's J2000 right ascension, in radians. tmdec The source's J2000 declination, in radians. ...
[ "Given", "a", "2MASS", "position", "look", "up", "the", "epoch", "when", "it", "was", "observed", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/astutil.py#L797-L842
train
62,381
pkgw/pwkit
pwkit/astutil.py
AstrometryInfo.verify
def verify (self, complain=True): """Validate that the attributes are self-consistent. This function does some basic checks of the object attributes to ensure that astrometric calculations can legally be performed. If the *complain* keyword is true, messages may be printed to :d...
python
def verify (self, complain=True): """Validate that the attributes are self-consistent. This function does some basic checks of the object attributes to ensure that astrometric calculations can legally be performed. If the *complain* keyword is true, messages may be printed to :d...
[ "def", "verify", "(", "self", ",", "complain", "=", "True", ")", ":", "import", "sys", "if", "self", ".", "ra", "is", "None", ":", "raise", "ValueError", "(", "'AstrometryInfo missing \"ra\"'", ")", "if", "self", ".", "dec", "is", "None", ":", "raise", ...
Validate that the attributes are self-consistent. This function does some basic checks of the object attributes to ensure that astrometric calculations can legally be performed. If the *complain* keyword is true, messages may be printed to :data:`sys.stderr` if non-fatal issues are enco...
[ "Validate", "that", "the", "attributes", "are", "self", "-", "consistent", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/astutil.py#L994-L1066
train
62,382
pkgw/pwkit
pwkit/astutil.py
AstrometryInfo.fill_from_simbad
def fill_from_simbad (self, ident, debug=False): """Fill in astrometric information using the Simbad web service. This uses the CDS Simbad web service to look up astrometric information for the source name *ident* and fills in attributes appropriately. Values from Simbad are not always ...
python
def fill_from_simbad (self, ident, debug=False): """Fill in astrometric information using the Simbad web service. This uses the CDS Simbad web service to look up astrometric information for the source name *ident* and fills in attributes appropriately. Values from Simbad are not always ...
[ "def", "fill_from_simbad", "(", "self", ",", "ident", ",", "debug", "=", "False", ")", ":", "info", "=", "get_simbad_astrometry_info", "(", "ident", ",", "debug", "=", "debug", ")", "posref", "=", "'unknown'", "for", "k", ",", "v", "in", "six", ".", "i...
Fill in astrometric information using the Simbad web service. This uses the CDS Simbad web service to look up astrometric information for the source name *ident* and fills in attributes appropriately. Values from Simbad are not always reliable. Returns *self*.
[ "Fill", "in", "astrometric", "information", "using", "the", "Simbad", "web", "service", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/astutil.py#L1242-L1300
train
62,383
pkgw/pwkit
pwkit/astutil.py
AstrometryInfo.fill_from_allwise
def fill_from_allwise (self, ident, catalog_ident='II/328/allwise'): """Fill in astrometric information from the AllWISE catalog using Astroquery. This uses the :mod:`astroquery` module to query the AllWISE (2013wise.rept....1C) source catalog through the Vizier (2000A&AS..143...23O) we...
python
def fill_from_allwise (self, ident, catalog_ident='II/328/allwise'): """Fill in astrometric information from the AllWISE catalog using Astroquery. This uses the :mod:`astroquery` module to query the AllWISE (2013wise.rept....1C) source catalog through the Vizier (2000A&AS..143...23O) we...
[ "def", "fill_from_allwise", "(", "self", ",", "ident", ",", "catalog_ident", "=", "'II/328/allwise'", ")", ":", "from", "astroquery", ".", "vizier", "import", "Vizier", "import", "numpy", ".", "ma", ".", "core", "as", "ma_core", "# We should match exactly one tabl...
Fill in astrometric information from the AllWISE catalog using Astroquery. This uses the :mod:`astroquery` module to query the AllWISE (2013wise.rept....1C) source catalog through the Vizier (2000A&AS..143...23O) web service. It then fills in the instance with the relevant information. ...
[ "Fill", "in", "astrometric", "information", "from", "the", "AllWISE", "catalog", "using", "Astroquery", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/astutil.py#L1303-L1383
train
62,384
pkgw/pwkit
pwkit/cli/__init__.py
backtrace_on_usr1
def backtrace_on_usr1 (): """Install a signal handler such that this program prints a Python traceback upon receipt of SIGUSR1. This could be useful for checking that long-running programs are behaving properly, or for discovering where an infinite loop is occurring. Note, however, that the Python ...
python
def backtrace_on_usr1 (): """Install a signal handler such that this program prints a Python traceback upon receipt of SIGUSR1. This could be useful for checking that long-running programs are behaving properly, or for discovering where an infinite loop is occurring. Note, however, that the Python ...
[ "def", "backtrace_on_usr1", "(", ")", ":", "import", "signal", "try", ":", "signal", ".", "signal", "(", "signal", ".", "SIGUSR1", ",", "_print_backtrace_signal_handler", ")", "except", "Exception", "as", "e", ":", "warn", "(", "'failed to set up Python backtraces...
Install a signal handler such that this program prints a Python traceback upon receipt of SIGUSR1. This could be useful for checking that long-running programs are behaving properly, or for discovering where an infinite loop is occurring. Note, however, that the Python interpreter does not invoke Pytho...
[ "Install", "a", "signal", "handler", "such", "that", "this", "program", "prints", "a", "Python", "traceback", "upon", "receipt", "of", "SIGUSR1", ".", "This", "could", "be", "useful", "for", "checking", "that", "long", "-", "running", "programs", "are", "beh...
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/cli/__init__.py#L157-L174
train
62,385
pkgw/pwkit
pwkit/cli/__init__.py
fork_detached_process
def fork_detached_process (): """Fork this process, creating a subprocess detached from the current context. Returns a :class:`pwkit.Holder` instance with information about what happened. Its fields are: whoami A string, either "original" or "forked" depending on which process we are. pipe ...
python
def fork_detached_process (): """Fork this process, creating a subprocess detached from the current context. Returns a :class:`pwkit.Holder` instance with information about what happened. Its fields are: whoami A string, either "original" or "forked" depending on which process we are. pipe ...
[ "def", "fork_detached_process", "(", ")", ":", "import", "os", ",", "struct", "from", ".", ".", "import", "Holder", "payload", "=", "struct", ".", "Struct", "(", "'L'", ")", "info", "=", "Holder", "(", ")", "readfd", ",", "writefd", "=", "os", ".", "...
Fork this process, creating a subprocess detached from the current context. Returns a :class:`pwkit.Holder` instance with information about what happened. Its fields are: whoami A string, either "original" or "forked" depending on which process we are. pipe An open binary file descriptor. ...
[ "Fork", "this", "process", "creating", "a", "subprocess", "detached", "from", "the", "current", "context", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/cli/__init__.py#L261-L345
train
62,386
pkgw/pwkit
pwkit/cli/__init__.py
pop_option
def pop_option (ident, argv=None): """A lame routine for grabbing command-line arguments. Returns a boolean indicating whether the option was present. If it was, it's removed from the argument string. Because of the lame behavior, options can't be combined, and non-boolean options aren't supported. Oper...
python
def pop_option (ident, argv=None): """A lame routine for grabbing command-line arguments. Returns a boolean indicating whether the option was present. If it was, it's removed from the argument string. Because of the lame behavior, options can't be combined, and non-boolean options aren't supported. Oper...
[ "def", "pop_option", "(", "ident", ",", "argv", "=", "None", ")", ":", "if", "argv", "is", "None", ":", "from", "sys", "import", "argv", "if", "len", "(", "ident", ")", "==", "1", ":", "ident", "=", "'-'", "+", "ident", "else", ":", "ident", "=",...
A lame routine for grabbing command-line arguments. Returns a boolean indicating whether the option was present. If it was, it's removed from the argument string. Because of the lame behavior, options can't be combined, and non-boolean options aren't supported. Operates on sys.argv by default. Note...
[ "A", "lame", "routine", "for", "grabbing", "command", "-", "line", "arguments", ".", "Returns", "a", "boolean", "indicating", "whether", "the", "option", "was", "present", ".", "If", "it", "was", "it", "s", "removed", "from", "the", "argument", "string", "...
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/cli/__init__.py#L350-L372
train
62,387
pkgw/pwkit
pwkit/cli/__init__.py
show_usage
def show_usage (docstring, short, stream, exitcode): """Print program usage information and exit. :arg str docstring: the program help text This function just prints *docstring* and exits. In most cases, the function :func:`check_usage` should be used: it automatically checks :data:`sys.argv` for ...
python
def show_usage (docstring, short, stream, exitcode): """Print program usage information and exit. :arg str docstring: the program help text This function just prints *docstring* and exits. In most cases, the function :func:`check_usage` should be used: it automatically checks :data:`sys.argv` for ...
[ "def", "show_usage", "(", "docstring", ",", "short", ",", "stream", ",", "exitcode", ")", ":", "if", "stream", "is", "None", ":", "from", "sys", "import", "stdout", "as", "stream", "if", "not", "short", ":", "print", "(", "'Usage:'", ",", "docstring", ...
Print program usage information and exit. :arg str docstring: the program help text This function just prints *docstring* and exits. In most cases, the function :func:`check_usage` should be used: it automatically checks :data:`sys.argv` for a sole "-h" or "--help" argument and invokes this functi...
[ "Print", "program", "usage", "information", "and", "exit", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/cli/__init__.py#L375-L410
train
62,388
pkgw/pwkit
pwkit/cli/__init__.py
wrong_usage
def wrong_usage (docstring, *rest): """Print a message indicating invalid command-line arguments and exit with an error code. :arg str docstring: the program help text :arg rest: an optional specific error message This function is intended for small programs launched from the command line. The...
python
def wrong_usage (docstring, *rest): """Print a message indicating invalid command-line arguments and exit with an error code. :arg str docstring: the program help text :arg rest: an optional specific error message This function is intended for small programs launched from the command line. The...
[ "def", "wrong_usage", "(", "docstring", ",", "*", "rest", ")", ":", "intext", "=", "False", "if", "len", "(", "rest", ")", "==", "0", ":", "detail", "=", "'invalid command-line arguments'", "elif", "len", "(", "rest", ")", "==", "1", ":", "detail", "="...
Print a message indicating invalid command-line arguments and exit with an error code. :arg str docstring: the program help text :arg rest: an optional specific error message This function is intended for small programs launched from the command line. The intention is for the program help informat...
[ "Print", "a", "message", "indicating", "invalid", "command", "-", "line", "arguments", "and", "exit", "with", "an", "error", "code", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/cli/__init__.py#L450-L500
train
62,389
pkgw/pwkit
pwkit/cli/__init__.py
_InterruptSignalPropagator.excepthook
def excepthook (self, etype, evalue, etb): """Handle an uncaught exception. We always forward the exception on to whatever `sys.excepthook` was present upon setup. However, if the exception is a KeyboardInterrupt, we additionally kill ourselves with an uncaught SIGINT, so that invoking p...
python
def excepthook (self, etype, evalue, etb): """Handle an uncaught exception. We always forward the exception on to whatever `sys.excepthook` was present upon setup. However, if the exception is a KeyboardInterrupt, we additionally kill ourselves with an uncaught SIGINT, so that invoking p...
[ "def", "excepthook", "(", "self", ",", "etype", ",", "evalue", ",", "etb", ")", ":", "self", ".", "inner_excepthook", "(", "etype", ",", "evalue", ",", "etb", ")", "if", "issubclass", "(", "etype", ",", "KeyboardInterrupt", ")", ":", "# Don't try this at h...
Handle an uncaught exception. We always forward the exception on to whatever `sys.excepthook` was present upon setup. However, if the exception is a KeyboardInterrupt, we additionally kill ourselves with an uncaught SIGINT, so that invoking programs know what happened.
[ "Handle", "an", "uncaught", "exception", ".", "We", "always", "forward", "the", "exception", "on", "to", "whatever", "sys", ".", "excepthook", "was", "present", "upon", "setup", ".", "However", "if", "the", "exception", "is", "a", "KeyboardInterrupt", "we", ...
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/cli/__init__.py#L122-L136
train
62,390
pkgw/pwkit
pwkit/dulk_models.py
calc_nu_b
def calc_nu_b(b): """Calculate the cyclotron frequency in Hz given a magnetic field strength in Gauss. This is in cycles per second not radians per second; i.e. there is a 2π in the denominator: ν_B = e B / (2π m_e c) """ return cgs.e * b / (2 * cgs.pi * cgs.me * cgs.c)
python
def calc_nu_b(b): """Calculate the cyclotron frequency in Hz given a magnetic field strength in Gauss. This is in cycles per second not radians per second; i.e. there is a 2π in the denominator: ν_B = e B / (2π m_e c) """ return cgs.e * b / (2 * cgs.pi * cgs.me * cgs.c)
[ "def", "calc_nu_b", "(", "b", ")", ":", "return", "cgs", ".", "e", "*", "b", "/", "(", "2", "*", "cgs", ".", "pi", "*", "cgs", ".", "me", "*", "cgs", ".", "c", ")" ]
Calculate the cyclotron frequency in Hz given a magnetic field strength in Gauss. This is in cycles per second not radians per second; i.e. there is a 2π in the denominator: ν_B = e B / (2π m_e c)
[ "Calculate", "the", "cyclotron", "frequency", "in", "Hz", "given", "a", "magnetic", "field", "strength", "in", "Gauss", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/dulk_models.py#L41-L48
train
62,391
pkgw/pwkit
pwkit/dulk_models.py
calc_freefree_snu_ujy
def calc_freefree_snu_ujy(ne, t, width, elongation, dist, ghz): """Calculate a flux density from pure free-free emission. """ hz = ghz * 1e9 eta = calc_freefree_eta(ne, t, hz) kappa = calc_freefree_kappa(ne, t, hz) snu = calc_snu(eta, kappa, width, elongation, dist) ujy = snu * cgs.jypercgs...
python
def calc_freefree_snu_ujy(ne, t, width, elongation, dist, ghz): """Calculate a flux density from pure free-free emission. """ hz = ghz * 1e9 eta = calc_freefree_eta(ne, t, hz) kappa = calc_freefree_kappa(ne, t, hz) snu = calc_snu(eta, kappa, width, elongation, dist) ujy = snu * cgs.jypercgs...
[ "def", "calc_freefree_snu_ujy", "(", "ne", ",", "t", ",", "width", ",", "elongation", ",", "dist", ",", "ghz", ")", ":", "hz", "=", "ghz", "*", "1e9", "eta", "=", "calc_freefree_eta", "(", "ne", ",", "t", ",", "hz", ")", "kappa", "=", "calc_freefree_...
Calculate a flux density from pure free-free emission.
[ "Calculate", "a", "flux", "density", "from", "pure", "free", "-", "free", "emission", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/dulk_models.py#L92-L101
train
62,392
pkgw/pwkit
pwkit/environments/casa/tasks.py
concat
def concat(invises, outvis, timesort=False): """Concatenate visibility measurement sets. invises (list of str) Paths to the input measurement sets outvis (str) Path to the output measurement set. timesort (boolean) If true, sort the output in time after concatenation. Example:: ...
python
def concat(invises, outvis, timesort=False): """Concatenate visibility measurement sets. invises (list of str) Paths to the input measurement sets outvis (str) Path to the output measurement set. timesort (boolean) If true, sort the output in time after concatenation. Example:: ...
[ "def", "concat", "(", "invises", ",", "outvis", ",", "timesort", "=", "False", ")", ":", "tb", "=", "util", ".", "tools", ".", "table", "(", ")", "ms", "=", "util", ".", "tools", ".", "ms", "(", ")", "if", "os", ".", "path", ".", "exists", "(",...
Concatenate visibility measurement sets. invises (list of str) Paths to the input measurement sets outvis (str) Path to the output measurement set. timesort (boolean) If true, sort the output in time after concatenation. Example:: from pwkit.environments.casa import tasks ...
[ "Concatenate", "visibility", "measurement", "sets", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/environments/casa/tasks.py#L658-L701
train
62,393
pkgw/pwkit
pwkit/environments/casa/tasks.py
delcal
def delcal(mspath): """Delete the ``MODEL_DATA`` and ``CORRECTED_DATA`` columns from a measurement set. mspath (str) The path to the MS to modify Example:: from pwkit.environments.casa import tasks tasks.delcal('dataset.ms') """ wantremove = 'MODEL_DATA CORRECTED_DATA'.split() ...
python
def delcal(mspath): """Delete the ``MODEL_DATA`` and ``CORRECTED_DATA`` columns from a measurement set. mspath (str) The path to the MS to modify Example:: from pwkit.environments.casa import tasks tasks.delcal('dataset.ms') """ wantremove = 'MODEL_DATA CORRECTED_DATA'.split() ...
[ "def", "delcal", "(", "mspath", ")", ":", "wantremove", "=", "'MODEL_DATA CORRECTED_DATA'", ".", "split", "(", ")", "tb", "=", "util", ".", "tools", ".", "table", "(", ")", "tb", ".", "open", "(", "b", "(", "mspath", ")", ",", "nomodify", "=", "False...
Delete the ``MODEL_DATA`` and ``CORRECTED_DATA`` columns from a measurement set. mspath (str) The path to the MS to modify Example:: from pwkit.environments.casa import tasks tasks.delcal('dataset.ms')
[ "Delete", "the", "MODEL_DATA", "and", "CORRECTED_DATA", "columns", "from", "a", "measurement", "set", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/environments/casa/tasks.py#L732-L758
train
62,394
pkgw/pwkit
pwkit/environments/casa/tasks.py
delmod_cli
def delmod_cli(argv, alter_logger=True): """Command-line access to ``delmod`` functionality. The ``delmod`` task deletes "on-the-fly" model information from a Measurement Set. It is so easy to implement that a standalone function is essentially unnecessary. Just write:: from pwkit.environments.c...
python
def delmod_cli(argv, alter_logger=True): """Command-line access to ``delmod`` functionality. The ``delmod`` task deletes "on-the-fly" model information from a Measurement Set. It is so easy to implement that a standalone function is essentially unnecessary. Just write:: from pwkit.environments.c...
[ "def", "delmod_cli", "(", "argv", ",", "alter_logger", "=", "True", ")", ":", "check_usage", "(", "delmod_doc", ",", "argv", ",", "usageifnoargs", "=", "True", ")", "if", "alter_logger", ":", "util", ".", "logger", "(", ")", "cb", "=", "util", ".", "to...
Command-line access to ``delmod`` functionality. The ``delmod`` task deletes "on-the-fly" model information from a Measurement Set. It is so easy to implement that a standalone function is essentially unnecessary. Just write:: from pwkit.environments.casa import util cb = util.tools.calibrater...
[ "Command", "-", "line", "access", "to", "delmod", "functionality", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/environments/casa/tasks.py#L788-L814
train
62,395
pkgw/pwkit
pwkit/environments/casa/tasks.py
extractbpflags
def extractbpflags(calpath, deststream): """Make a flags file out of a bandpass calibration table calpath (str) The path to the bandpass calibration table deststream (stream-like object, e.g. an opened file) Where to write the flags data Below is documentation written for the command-line ...
python
def extractbpflags(calpath, deststream): """Make a flags file out of a bandpass calibration table calpath (str) The path to the bandpass calibration table deststream (stream-like object, e.g. an opened file) Where to write the flags data Below is documentation written for the command-line ...
[ "def", "extractbpflags", "(", "calpath", ",", "deststream", ")", ":", "tb", "=", "util", ".", "tools", ".", "table", "(", ")", "tb", ".", "open", "(", "b", "(", "os", ".", "path", ".", "join", "(", "calpath", ",", "'ANTENNA'", ")", ")", ")", "ant...
Make a flags file out of a bandpass calibration table calpath (str) The path to the bandpass calibration table deststream (stream-like object, e.g. an opened file) Where to write the flags data Below is documentation written for the command-line interface to this functionality:
[ "Make", "a", "flags", "file", "out", "of", "a", "bandpass", "calibration", "table" ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/environments/casa/tasks.py#L976-L1033
train
62,396
pkgw/pwkit
pwkit/environments/casa/tasks.py
flagmanager_cli
def flagmanager_cli(argv, alter_logger=True): """Command-line access to ``flagmanager`` functionality. The ``flagmanager`` task manages tables of flags associated with measurement sets. Its features are easy to implement that a standalone library function is essentially unnecessary. See the source code...
python
def flagmanager_cli(argv, alter_logger=True): """Command-line access to ``flagmanager`` functionality. The ``flagmanager`` task manages tables of flags associated with measurement sets. Its features are easy to implement that a standalone library function is essentially unnecessary. See the source code...
[ "def", "flagmanager_cli", "(", "argv", ",", "alter_logger", "=", "True", ")", ":", "check_usage", "(", "flagmanager_doc", ",", "argv", ",", "usageifnoargs", "=", "True", ")", "if", "len", "(", "argv", ")", "<", "3", ":", "wrong_usage", "(", "flagmanager_do...
Command-line access to ``flagmanager`` functionality. The ``flagmanager`` task manages tables of flags associated with measurement sets. Its features are easy to implement that a standalone library function is essentially unnecessary. See the source code to this function for the tool calls that impleme...
[ "Command", "-", "line", "access", "to", "flagmanager", "functionality", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/environments/casa/tasks.py#L1192-L1258
train
62,397
pkgw/pwkit
pwkit/environments/casa/tasks.py
image2fits
def image2fits(mspath, fitspath, velocity=False, optical=False, bitpix=-32, minpix=0, maxpix=-1, overwrite=False, dropstokes=False, stokeslast=True, history=True, **kwargs): """Convert an image in MS format to FITS format. mspath (str) The path to the input MS. fitspat...
python
def image2fits(mspath, fitspath, velocity=False, optical=False, bitpix=-32, minpix=0, maxpix=-1, overwrite=False, dropstokes=False, stokeslast=True, history=True, **kwargs): """Convert an image in MS format to FITS format. mspath (str) The path to the input MS. fitspat...
[ "def", "image2fits", "(", "mspath", ",", "fitspath", ",", "velocity", "=", "False", ",", "optical", "=", "False", ",", "bitpix", "=", "-", "32", ",", "minpix", "=", "0", ",", "maxpix", "=", "-", "1", ",", "overwrite", "=", "False", ",", "dropstokes",...
Convert an image in MS format to FITS format. mspath (str) The path to the input MS. fitspath (str) The path to the output FITS file. velocity (boolean) (To be documented.) optical (boolean) (To be documented.) bitpix (integer) (To be documented.) minpix (integer) ...
[ "Convert", "an", "image", "in", "MS", "format", "to", "FITS", "format", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/environments/casa/tasks.py#L2203-L2240
train
62,398
pkgw/pwkit
pwkit/environments/casa/tasks.py
importalma
def importalma(asdm, ms): """Convert an ALMA low-level ASDM dataset to Measurement Set format. asdm (str) The path to the input ASDM dataset. ms (str) The path to the output MS dataset. This implementation automatically infers the value of the "tbuff" parameter. Example:: f...
python
def importalma(asdm, ms): """Convert an ALMA low-level ASDM dataset to Measurement Set format. asdm (str) The path to the input ASDM dataset. ms (str) The path to the output MS dataset. This implementation automatically infers the value of the "tbuff" parameter. Example:: f...
[ "def", "importalma", "(", "asdm", ",", "ms", ")", ":", "from", ".", "scripting", "import", "CasapyScript", "script", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "'cscript_importalma.py'", ")", ...
Convert an ALMA low-level ASDM dataset to Measurement Set format. asdm (str) The path to the input ASDM dataset. ms (str) The path to the output MS dataset. This implementation automatically infers the value of the "tbuff" parameter. Example:: from pwkit.environments.casa impor...
[ "Convert", "an", "ALMA", "low", "-", "level", "ASDM", "dataset", "to", "Measurement", "Set", "format", "." ]
d40957a1c3d2ea34e7ceac2267ee9635135f2793
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/environments/casa/tasks.py#L2267-L2288
train
62,399