text stringlengths 18 773k |
|---|
def elcm_profile_delete(irmc_info, profile_name):
"""send an eLCM request to delete a profile
:param irmc_info: node info
:param profile_name: name of profile
:raises: ELCMProfileNotFound if the profile does not exist
:raises: SCCIClientError if SCCI failed
"""
# Send DELETE request to the ... |
def elcm_session_list(irmc_info):
"""send an eLCM request to list all sessions
:param irmc_info: node info
:returns: dict object of sessions if succeed
{
'SessionList':
{
'Contains':
[
{ 'Id': id1, 'Name': name1 },
{ 'Id': id2,... |
def elcm_session_get_status(irmc_info, session_id):
"""send an eLCM request to get session status
:param irmc_info: node info
:param session_id: session id
:returns: dict object of session info if succeed
{
'Session':
{
'Id': id
'Status': status
... |
def elcm_session_terminate(irmc_info, session_id):
"""send an eLCM request to terminate a session
:param irmc_info: node info
:param session_id: session id
:raises: ELCMSessionNotFound if the session does not exist
:raises: SCCIClientError if SCCI failed
"""
# Send DELETE request to the ser... |
def elcm_session_delete(irmc_info, session_id, terminate=False):
"""send an eLCM request to remove a session from the session list
:param irmc_info: node info
:param session_id: session id
:param terminate: a running session must be terminated before removing
:raises: ELCMSessionNotFound if the ses... |
def _process_session_data(irmc_info, operation, session_id,
session_timeout=BIOS_CONFIG_SESSION_TIMEOUT):
"""process session for Bios config backup/restore or RAID config operation
:param irmc_info: node info
:param operation: one of 'BACKUP_BIOS', 'RESTORE_BIOS' or 'CONFIG_RAID'
... |
def backup_bios_config(irmc_info):
"""backup current bios configuration
This function sends a BACKUP BIOS request to the server. Then when the bios
config data are ready for retrieving, it will return the data to the
caller. Note that this operation may take time.
:param irmc_info: node info
:... |
def restore_bios_config(irmc_info, bios_config):
"""restore bios configuration
This function sends a RESTORE BIOS request to the server. Then when the
bios
is ready for restoring, it will apply the provided settings and return.
Note that this operation may take time.
:param irmc_info: node inf... |
def get_secure_boot_mode(irmc_info):
"""Get the status if secure boot is enabled or not.
:param irmc_info: node info.
:raises: SecureBootConfigNotFound, if there is no configuration for secure
boot mode in the bios.
:return: True if secure boot mode is enabled on the node, False otherwise.... |
def set_secure_boot_mode(irmc_info, enable):
"""Enable/Disable secure boot on the server.
:param irmc_info: node info
:param enable: True, if secure boot needs to be
enabled for next boot, else False.
"""
bios_config_data = {
'Server': {
'@Version': '1.01',
... |
def _update_raid_input_data(target_raid_config, raid_input):
"""Process raid input data.
:param target_raid_config: node raid info
:param raid_input: raid information for creating via eLCM
:raises ELCMValueError: raise msg if wrong input
:return: raid_input: raid input data which create raid config... |
def _get_existing_logical_drives(raid_adapter):
"""Collect existing logical drives on the server.
:param raid_adapter: raid adapter info
:returns: existing_logical_drives: get logical drive on server
"""
existing_logical_drives = []
logical_drives = raid_adapter['Server']['HWConfigurationIrmc']... |
def _create_raid_adapter_profile(irmc_info):
"""Attempt delete exist adapter then create new raid adapter on the server.
:param irmc_info: node info
:returns: result: a dict with following values:
{
'raid_config': <data of raid adapter profile>,
'warn... |
def create_raid_configuration(irmc_info, target_raid_config):
"""Process raid_input then perform raid configuration into server.
:param irmc_info: node info
:param target_raid_config: node raid information
"""
if len(target_raid_config['logical_disks']) < 1:
raise ELCMValueError(message="l... |
def delete_raid_configuration(irmc_info):
"""Delete whole raid configuration or one of logical drive on the server.
:param irmc_info: node info
"""
# Attempt to get raid configuration on BM Server
raid_adapter = get_raid_adapter(irmc_info)
existing_logical_drives = _get_existing_logical_drives(... |
def set_bios_configuration(irmc_info, settings):
"""Set BIOS configurations on the server.
:param irmc_info: node info
:param settings: Dictionary containing the BIOS configuration.
:raise: BiosConfigNotFound, if there is wrong settings for bios
configuration.
"""
bios_config_data = {
... |
def get_bios_settings(irmc_info):
"""Get the current BIOS settings on the server
:param irmc_info: node info.
:returns: a list of dictionary BIOS settings
"""
bios_config = backup_bios_config(irmc_info)['bios_config']
bios_config_data = bios_config['Server']['SystemConfig']['BiosConfig']
s... |
def add_resource_context(router: web.AbstractRouter,
url_prefix: str = None,
name_prefix: str = None) -> Iterator[Any]:
"""Context manager for adding resources for given router.
Main goal of context manager to easify process of adding resources with
routes ... |
def parse_aioredis_url(url: str) -> DictStrAny:
"""
Convert Redis URL string to dict suitable to pass to
``aioredis.create_redis(...)`` call.
**Usage**::
async def connect_redis(url=None):
url = url or 'redis://localhost:6379/0'
return await create_redis(**get_aioredis_... |
def str_kwargs(self):
"""
Generator that yields a dict of values corresponding to the ... |
def oggvorbis(s):
"""
This is taken from the ogg vorbis spec
(http://xiph.org/vorbis/doc/Vorbis_I_spec.html)
:param s: the total length of the window, in samples
"""
try:
s = np.arange(s)
except TypeError:
s = np.arange(s[0])
i = np.sin((s + .5) / len(s) * np.pi) ** 2
... |
def convert_source_location(self, source_reading, reference_reading):
"""
Converts the source (x, y) location from reading into the coordinate
system of reference_reading.
"""
offset_x, offset_y = reference_reading.get_coordinate_offset(source_reading)
focus = source_read... |
def calculate_focus(self, reading):
"""
Determines what the focal point of the downloaded image should be.
Returns:
focal_point: (x, y)
The location of the source in the middle observation, in the
coordinate system of the current source reading.
"""
... |
def top_down_SolarSystem(discoveries,
inner_limit=6, # truncate at 8 AU to show that we don't have sensitivity in close
extent=83, # extend to 83 AU as indicative only, sensitivity is to ~300 AU
plot_discoveries=None,
... |
def plot_ossos_discoveries(ax, discoveries, plot_discoveries,
plot_colossos=False, split_plutinos=False):
"""
plotted at their discovery locations, provided by the Version Releases in decimal degrees.
"""
fc = ['b', '#E47833', 'k']
alpha = [0.85, 0.6, 1.]
marker = ['o'... |
def orbit_fit_residuals(discoveries, blockID='O13AE'):
"""Brett: What are relevant and stunning are the actual orbit fit residuals
for orbits with d(a)/a<1%. I would be happy with a simple histogram of all those numbers,
although the 'tail' (probably blended and not yet completely flagged) should
perhap... |
def get_irmc_firmware_version(snmp_client):
"""Get irmc firmware version of the node.
:param snmp_client: an SNMP client object.
:raises: SNMPFailure if SNMP operation failed.
:returns: a string of bmc name and irmc firmware version.
"""
try:
bmc_name = snmp_client.get(BMC_NAME_OID)
... |
def get_bios_firmware_version(snmp_client):
"""Get bios firmware version of the node.
:param snmp_client: an SNMP client object.
:raises: SNMPFailure if SNMP operation failed.
:returns: a string of bios firmware version.
"""
try:
bios_firmware_version = snmp_client.get(BIOS_FW_VERSION_... |
def get_server_model(snmp_client):
"""Get server model of the node.
:param snmp_client: an SNMP client object.
:raises: SNMPFailure if SNMP operation failed.
:returns: a string of server model.
"""
try:
server_model = snmp_client.get(SERVER_MODEL_OID)
return six.text_type(serve... |
def _get_auth(self):
"""Return the authorization data for an SNMP request.
:returns: A
:class:`pysnmp.entity.rfc3413.oneliner.cmdgen.CommunityData`
object.
"""
if self.version == SNMP_V3:
# Handling auth/encryption credentials is not (yet) supported.
... |
def get(self, oid):
"""Use PySNMP to perform an SNMP GET operation on a single object.
:param oid: The OID of the object to get.
:raises: SNMPFailure if an SNMP request fails.
:returns: The value of the requested object.
"""
try:
results = self.cmd_gen.getCmd... |
def get_next(self, oid):
"""Use PySNMP to perform an SNMP GET NEXT operation on a table object.
:param oid: The OID of the object to get.
:raises: SNMPFailure if an SNMP request fails.
:returns: A list of values of the requested table object.
"""
try:
results... |
def set(self, oid, value):
"""Use PySNMP to perform an SNMP SET operation on a single object.
:param oid: The OID of the object to set.
:param value: The value of the object to set.
:raises: SNMPFailure if an SNMP request fails.
"""
try:
results = self.cmd_ge... |
def filename(self):
"""
Name if the MOP formatted file to parse.
@rtype: basestring
@return: filename
"""
if self._filename is None:
self._filename = storage.get_file(self.basename,
self.ccd,
... |
def _parse(self):
"""read in a file and return a MOPFile object."""
with open(self.filename, 'r') as fobj:
lines = fobj.read().split('\n')
# Create a header object with content at start of file
self.header = MOPHeader(self.subfmt).parser(lines)
# Create a data attri... |
def table(self):
"""
The astropy.table.Table object that will contain the data result
@rtype: Table
@return: data table
"""
if self._table is None:
column_names = []
for fileid in self.header.file_ids:
for column_name in self.header... |
def parser(self, lines):
"""Given a set of lines parse the into a MOP Header"""
while len(lines) > 0:
if lines[0].startswith('##') and lines[1].startswith('# '):
# A two-line keyword/value line starts here.
self._header_append(lines.pop(0), lines.pop(0))
... |
def _compute_mjd(self, kw, val):
"""
Sometimes that MJD-OBS-CENTER keyword maps to a three component string, instead of a single value.
@param kw: a list of keywords
@param val: a list of matching values
@return: the MJD-OBS-CENTER as a julian date.
"""
try:
... |
def getExpInfo(expnum):
"""Return a dictionary of information about a particular exposure"""
col_names=['object',
'e.expnum',
'mjdate',
'uttime',
'filter',
'elongation',
'obs_iq_refccd',
'triple', 'qso_stat... |
def getTripInfo(triple):
"""Return a dictionary of information about a particular triple"""
col_names=['mjdate', 'filter', 'elongation', 'discovery','checkup', 'recovery', 'iq','block' ]
sql="SELECT mjdate md,"
sql=sql+" filter, avg(elongation), d.id, checkup.checkup, recovery.recovery , avg(obs_iq_ref... |
def getExpnums(pointing,night=None):
"""Get all exposures of specified pointing ID.
Default is to return a list of all exposure numbers"""
if night:
night=" floor(e.mjdate-0.0833)=%d " % ( night )
else:
night=''
sql="SELECT e.expnum "
sql=sql+"FROM bucket.exposure e "
... |
def getTriples(pointing):
"""Get all triples of a specified pointing ID.
Defaults is to return a complete list triples."""
sql="SELECT id FROM triples t join triple_members m ON t.id=m.triple"
sql+=" join bucket.exposure e on e.expnum=m.expnum "
sql+=" WHERE pointing=%s group by id order by e.ex... |
def createNewTriples(Win):
"""Add entries to the triples tables based on new images in the db"""
win.help("Building list of exposures to look for triples")
cols=('e.expnum', 'object',
'mjdate',
'uttime',
'elongation',
'filter',
'obs_iq_refccd','qso_status' )
header='%6s %... |
def setDiscoveryTriples(win,table="discovery"):
"""Provide user with a list of triples that could be discovery triples"""
win.help("Getting a list of pointings with triples from the CFEPS db")
pointings=getPointingsWithTriples()
win.help("Select the "+table+" triple form the list...")
import time
... |
def run(expnum,
ccd,
prefix='',
version='p',
sex_thresh=_SEX_THRESHOLD,
wave_thresh=_WAVE_THRESHOLD,
maxcount=_MAX_COUNT,
dry_run=False,
force=True):
"""run the actual step1jmp/matt codes.
expnum: the CFHT expousre to process
ccd: which ccd i... |
def query(ra ,dec, rad=0.1, query=None):
"""Query the CADC TAP service to determine the list of images for the
NewHorizons Search. Things to determine:
a- Images to have the reference subtracted from.
b- Image to use as the 'REFERENCE' image.
c- Images to be used for input into the reference image
L... |
def objIngest(obj_file):
import sys,os,math,re
import pyfits
import MOPfiles
obj=MOPfiles.read(obj_file)
"""
The SQL description of the source table
+-------------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra ... |
def load_edbfile(file=None):
"""Load the targets from a file"""
import ephem,string,math
if file is None:
import tkFileDialog
try:
file=tkFileDialog.askopenfilename()
except:
return
if file is None or file == '':
return
f=open(file)
lines=f.readl... |
def load_abgfiles(dir=None):
"""Load the targets from a file"""
import ephem,string
if dir is None:
import tkFileDialog
try:
dir=tkFileDialog.askdirectory()
except:
return
if dir is None:
return None
from glob import glob
files=glob(dir+"/*.abg")... |
def fits_list(filter,root,fnames):
"""Get a list of files matching filter in directory root"""
import re, pyfits, wcsutil
for file in fnames:
if re.match(filter,file):
fh=pyfits.open(file)
for ext in fh:
obj=ext.header.get('OBJECT',file)
dx=ext... |
def load_fis(dir=None):
"""Load fits images in a directory"""
if dir is None:
import tkFileDialog
try:
dir=tkFileDialog.askdirectory()
except:
return
if dir is None:
return None
from os.path import walk
walk(dir,fits_list,"*.fits") |
def do_objs(kbos):
"""Draw the actual plot"""
import orbfit, ephem, math
import re
re_string=w.FilterVar.get()
vlist=[]
for name in kbos:
if not re.search(re_string,name):
continue
vlist.append(name)
if type(kbos[name])==type(ephem.EllipticalBody()):
kbo... |
def eps(self):
"""Print the canvas to a postscript file"""
import tkFileDialog,tkMessageBox
filename=tkFileDialog.asksaveasfilename(message="save postscript to file",filetypes=['eps','ps'])
if filename is None:
return
self.postscript(file=filename) |
def c2s(self,p=[0,0]):
"""Convert from canvas to screen coordinates"""
return((p[0]-self.canvasx(self.cx1),p[1]-self.canvasy(self.cy1))) |
def coord_grid(self):
"""Draw a grid of RA/DEC on Canvas."""
import math,ephem
ra2=math.pi*2
ra1=0
dec1=-1*math.pi/2.0
dec2=math.pi/2.0
## grid space choices
## ra space in hours
ra_grids=["06:00:00",
"03:00:00",
... |
def label(self,x,y,label,offset=[0,0]):
"""Write label at plot coordinates (x,y)"""
(xc,yc)=self.p2c([x,y])
return self.create_text(xc-offset[0],yc-offset[1],text=label) |
def limits(self,x1,x2,y1,y2):
"""Set the coordinate boundaries of plot"""
import math
self.x1=x1
self.x2=x2
self.y1=y1
self.y2=y2
self.xscale=(self.cx2-self.cx1)/(self.x2-self.x1)
self.yscale=(self.cy2-self.cy1)/(self.y2-self.y1)
ra1=self.x1
ra2=self.x2... |
def reset(self):
"""Expand to the full scale"""
import ephem, MOPcoord
sun=ephem.Sun()
sun.compute(self.date.get())
self.sun=MOPcoord.coord((sun.ra,sun.dec))
doplot(kbos)
self.plot_pointings() |
def updateObj(self,event):
"""Put this object in the search box"""
name=w.objList.get("active")
w.SearchVar.set(name)
w.ObjInfo.set(objInfoDict[name])
return |
def relocate(self):
"""Move to the postion of self.SearchVar"""
name=self.SearchVar.get()
if kbos.has_key(name):
import orbfit,ephem,math
jdate=ephem.julian_date(w.date.get())
try:
(ra,dec,a,b,ang)=orbfit.predict(kbos[name],jdate,568)
except:
return
ra=math... |
def __zoom(self,event,scale=2.0):
"""Zoom in"""
import Tkinter,math
## compute the x,y of the center of the screen
sx1=self.cx1+(self.cx2-self.cx1+1.0)/2.0
sy1=self.cy1+(self.cy2-self.cy1+1.0)/2.0
#print sx1,sy1
if not event is None:
sx1=event.x
sy1=event.y
#print sx1,sy1... |
def create_ellipse(self,xcen,ycen,a,b,ang,resolution=40.0):
"""Plot ellipse at x,y with size a,b and orientation ang"""
import math
e1=[]
e2=[]
ang=ang-math.radians(90)
for i in range(0,int(resolution)+1):
x=(-1*a+2*a*float(i)/resolution)
y=1-(x/a... |
def get_pointings(self):
"""Query for some pointings, given a block name"""
import MOPdbaccess,ephem,math
import tkSimpleDialog
result = tkSimpleDialog.askstring("Block Load", "Which Block do you want to plot?")
db = MOPdbaccess.connect('bucket','cfhls',dbSystem='MYSQL')
SQL = "... |
def load_pointings(self):
"""Load some pointings"""
import os,re,ephem
import tkFileDialog,tkMessageBox
filename=tkFileDialog.askopenfilename()
if filename is None:
return
f=open(filename)
lines=f.readlines()
f.close()
points=[]
if lines[0][0:5]=="<?xml":
#... |
def create_pointing(self,event):
"""Plot the sky coverage of pointing at event.x,event.y on the canavas"""
import math
(ra,dec)=self.c2p((self.canvasx(event.x),
self.canvasy(event.y)))
this_camera=camera(camera=self.camera.get())
ccds=this_camera.getGe... |
def plot_pointings(self,pointings=None):
"""Plot pointings on canavs"""
if pointings is None:
pointings=self.pointings
i=0
for pointing in pointings:
items=[]
i=i+1
label={}
label['text']=pointing['label']['text']
for ccd in pointing["camera"... |
def set_pointing_label(self):
"""Let the label of the current pointing to the value in the plabel box"""
self.pointings[self.current]['label']['text']=w.plabel.get()
self.reset() |
def save_pointings(self):
"""Print the currently defined FOVs"""
import tkFileDialog
f=tkFileDialog.asksaveasfile()
i=0
if self.pointing_format.get()=='CFHT PH':
f.write("""<?xml version = "1.0"?>
<!DOCTYPE ASTRO SYSTEM "http://vizier.u-strasbg.fr/xml/astrores.dtd">
<ASTRO ... |
def getGeometry(self,ra=None,dec=None):
"""Return an array of rectangles that represent the 'ra,dec' corners of the FOV"""
import math,ephem
ccds=[]
if ra is None:
ra=self.ra
if dec is None:
dec=self.dec
self.ra=ephem.hours(ra)
self.dec=e... |
def separation(self,ra,dec):
"""Compute the separation between self and (ra,dec)"""
import ephem
return ephem.separation((self.ra,self.dec),(ra,dec)) |
def produce_fake_hash(x):
"""
Produce random, binary features, totally irrespective of the content of
x, but in the same shape as x.
"""
h = np.random.binomial(1, 0.5, (x.shape[0], 1024))
packed = np.packbits(h, axis=-1).view(np.uint64)
return zounds.ArrayWithUnits(
packed, [x.dimens... |
def _parse_raw_bytes(raw_bytes):
"""Convert a string of hexadecimal values to decimal values parameters
Example: '0x2E 0xF1 0x80 0x28 0x00 0x1A 0x01 0x00' is converted to:
46, 241, [128, 40, 0, 26, 1, 0]
:param raw_bytes: string of hexadecimal values
:returns: 3 decimal values
"""
... |
def _send_raw_command(ipmicmd, raw_bytes):
"""Use IPMI command object to send raw ipmi command to BMC
:param ipmicmd: IPMI command object
:param raw_bytes: string of hexadecimal values. This is commonly used
for certain vendor specific commands.
:returns: dict -- The response from IPMI device
... |
def get_tpm_status(d_info):
"""Get the TPM support status.
Get the TPM support status of the node.
:param d_info: the list of ipmitool parameters for accessing a node.
:returns: TPM support status
"""
# note:
# Get TPM support status : ipmi cmd '0xF5', valid flags '0xC0'
#
# $ ipm... |
def _pci_seq(ipmicmd):
"""Get output of ipmiraw command and the ordinal numbers.
:param ipmicmd: IPMI command object.
:returns: List of tuple contain ordinal number and output of ipmiraw
command.
"""
for i in range(1, 0xff + 1):
try:
res = _send_raw_command(ipmicmd, GET_PCI ... |
def get_pci_device(d_info, pci_device_ids):
"""Get quantity of PCI devices.
Get quantity of PCI devices of the node.
:param d_info: the list of ipmitool parameters for accessing a node.
:param pci_device_ids: the list contains pairs of <vendorID>/<deviceID> for
PCI devices.
:returns: the numbe... |
def defaults(current: dict, *args: AnyMapping) -> dict:
r"""Override current dict with defaults values.
:param current: Current dict.
:param \*args: Sequence with default data dicts.
"""
for data in args:
for key, value in data.items():
current.setdefault(key, value)
return ... |
def validate_func_factory(validator_class: Any) -> ValidateFunc:
"""Provide default function for Schema validation.
:param validator_class: JSONSchema suitable validator class.
"""
def validate_func(schema: AnyMapping, pure_data: AnyMapping) -> AnyMapping:
"""Validate schema with given data.
... |
def moreData(ra,dec,box):
"""Search the CFHT archive for more images of this location"""
import cfhtCutout
cdata={'ra_deg': ra, 'dec_deg': dec, 'radius_deg': 0.2}
inter=cfhtCutout.find_images(cdata,0.2) |
def xpacheck():
"""Check if xpa is running"""
import os
f=os.popen('xpaaccess ds9')
l=f.readline()
f.close()
if l.strip()!='yes':
logger.debug("\t Can't get ds9 access, xpaccess said: %s" % ( l.strip()))
return (False)
return(True) |
def mark(x,y,label=None):
"""Mark a circle on the current image"""
if label is not None:
os.system("xpaset -p ds9 regions color red ")
cmd="echo 'image; text %d %d # text={%s}' | xpaset ds9 regions " % ( x,y,label)
else:
os.system("xpaset -p ds9 regions color blue")
cmd="echo 'image; circle %d ... |
def display(url):
"""Display a file in ds9"""
import os
oscmd="curl --silent -g --fail --max-time 1800 --user jkavelaars '%s'" % (url)
logger.debug(oscmd)
os.system(oscmd+' | xpaset ds9 fits')
return |
def inv(self):
"""Invert the transform.
After calling this method, calling the instance will do the inverse
transform. Calling this twice return the instance to the original
transform.
"""
self.x, self.y = self.y, self.x
self._x_, self._y_ = self._y_, self._x_
... |
def matrix(self, full=False, keeppads=True):
"""Return matrix form of the integral transform.
Parameters
----------
full : bool, optional
when False return two vector factors and convolution matrix
separately, otherwise return full transformation matrix
k... |
def _pad(self, a, axis, extrap, out):
"""Add padding to an array.
Parameters
----------
a : (..., Nin, ...) ndarray
array to be padded to size `N`
axis : int
axis along which to pad
extrap : {bool, 'const'} or 2-tuple
Method to extrapo... |
def _unpad(self, a, axis, out):
"""Undo padding in an array.
Parameters
----------
a : (..., N, ...) ndarray
array to be trimmed to size `Nin`
axis : int
axis along which to unpad
out : bool
trim the output if True, otherwise the input... |
def check(self, F):
"""Rough sanity checks on the input function.
"""
assert F.ndim == 1, "checker only supports 1D"
f = self.xfac * F
fabs = np.abs(f)
iQ1, iQ3 = np.searchsorted(fabs.cumsum(), np.array([0.25, 0.75]) * fabs.sum())
assert 0 != iQ1 != iQ3 != self... |
def fft(x, axis=-1, padding_samples=0):
"""
Apply an FFT along the given dimension, and with the specified amount of
zero-padding
Args:
x (ArrayWithUnits): an :class:`~zounds.core.ArrayWithUnits` instance
which has one or more :class:`~zounds.timeseries.TimeDimension`
ax... |
def morlet_filter_bank(
samplerate,
kernel_size,
scale,
scaling_factor,
normalize=True):
"""
Create a :class:`~zounds.core.ArrayWithUnits` instance with a
:class:`~zounds.timeseries.TimeDimension` and a
:class:`~zounds.spectral.FrequencyDimension` representing a b... |
def set_bias(self, bias):
"""
Adjusts the image bias.
Bias determines where the color changes start. At low bias, low
intensities (i.e., low pixel values) will have non-zero color
differences, while at high bias only high pixel values will have
non-zero differences
... |
def set_contrast(self, contrast):
"""
Adjusts the image contrast.
Contrast refers to the rate of change of color with color level.
At low contrast, color changes gradually over many intensity
levels, while at high contrast it can change rapidly within a
few levels
... |
def _copy(src, dst, src_is_storage, dst_is_storage):
"""
Copies file from source to destination
Args:
src (str or file-like object): Source file.
dst (str or file-like object): Destination file.
src_is_storage (bool): Source is storage.
dst_is_storage (bool): Destination is ... |
def copy(src, dst):
"""
Copies a source file to a destination file or directory.
Equivalent to "shutil.copy".
Source and destination can also be binary opened file-like objects.
Args:
src (path-like object or file-like object): Source file.
dst (path-like object or file-like objec... |
def copyfile(src, dst, follow_symlinks=True):
"""
Copies a source file to a destination file.
Equivalent to "shutil.copyfile".
Source and destination can also be binary opened file-like objects.
Args:
src (path-like object or file-like object): Source file.
dst (path-like object o... |
def _handle_client_error():
"""
Handle boto exception and convert to class
IO exceptions
Raises:
OSError subclasses: IO error.
"""
try:
yield
except _ClientError as exception:
error = exception.response['Error']
if error['Code'] in _ERROR_CODES:
... |
def copy(self, src, dst, other_system=None):
"""
Copy object of the same storage.
Args:
src (str): Path or URL.
dst (str): Path or URL.
other_system (pycosio._core.io_system.SystemBase subclass): Unused.
"""
copy_source = self.get_client_kwarg... |
def get_client_kwargs(self, path):
"""
Get base keyword arguments for client for a
specific path.
Args:
path (str): Absolute path or URL.
Returns:
dict: client args
"""
bucket_name, key = self.split_locator(path)
kwargs = dict(Buc... |
def _get_session(self):
"""
S3 Boto3 Session.
Returns:
boto3.session.Session: session
"""
if self._session is None:
self._session = _boto3.session.Session(
**self._storage_parameters.get('session', dict()))
return self._session |
def _get_client(self):
"""
S3 Boto3 client
Returns:
boto3.session.Session.client: client
"""
client_kwargs = self._storage_parameters.get('client', dict())
# Handles unsecure mode
if self._unsecure:
client_kwargs = client_kwargs.copy()
... |
def _get_roots(self):
"""
Return URL roots for this storage.
Returns:
tuple of str or re.Pattern: URL roots
"""
region = self._get_session().region_name or r'[\w-]+'
return (
# S3 scheme
# - s3://<bucket>/<key>
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.