function
stringlengths
11
56k
repo_name
stringlengths
5
60
features
list
def clear_peak(self): self.peak = [] if self.peak_item: self.peak_item.setPath(QPainterPath())
jopohl/urh
[ 9230, 807, 9230, 35, 1459539787 ]
def __init__(self, cwd): self._newcwd = cwd self._oldcwd = None
ikalnytskyi/kostyor-openstack-ansible
[ 3, 4, 3, 3, 1479227243 ]
def __exit__(self, *args): if self._newcwd: os.chdir(self._oldcwd)
ikalnytskyi/kostyor-openstack-ansible
[ 3, 4, 3, 3, 1479227243 ]
def _run_playbook_impl(playbook, hosts_fn=None, cwd=None, ignore_errors=False): # Unfortunately, there's no good way to get the options instance # with proper defaults since it's generated by argparse inside # PlaybookCLI. Due to the fact that the options can't be empty # and must contain proper values ...
ikalnytskyi/kostyor-openstack-ansible
[ 3, 4, 3, 3, 1479227243 ]
def _run_playbook(playbook, cwd=None, ignore_errors=False): return _run_playbook_impl( playbook, cwd=cwd, ignore_errors=ignore_errors )
ikalnytskyi/kostyor-openstack-ansible
[ 3, 4, 3, 3, 1479227243 ]
def _run_playbook_for(playbook, hosts, service, cwd=None, ignore_errors=False): return _run_playbook_impl( playbook, lambda inv: base.get_component_hosts_on_nodes(inv, service, hosts), cwd=cwd, ignore_errors=ignore_errors )
ikalnytskyi/kostyor-openstack-ansible
[ 3, 4, 3, 3, 1479227243 ]
def prepare_step(self, *args, **kwargs): """Prepare build environment (skip loaded of dependencies).""" kwargs['load_tc_deps_modules'] = False super(CrayToolchain, self).prepare_step(*args, **kwargs)
eth-cscs/production
[ 48, 41, 48, 3, 1479828835 ]
def get_colour_names(): """Get a dictionary of all known colour names.""" from collections import OrderedDict return OrderedDict(sorted(_colours.items(), key=lambda t: t[0]))
expyriment/expyriment
[ 106, 37, 106, 6, 1375792731 ]
def is_rgb(value): """Check for valid RGB tuple value. Parameters ---------- value : iterable of length 3 (e.g. [255, 0, 0]) the value to be checked Returns ------- valid : bool whether the value is valid or not """ if n...
expyriment/expyriment
[ 106, 37, 106, 6, 1375792731 ]
def is_name(value): """Check for valid colour name value. Parameters ---------- value : str (e.g. "red") the value to be checked Returns ------- valid : bool whether the value is valid or not """ if not value in _colours...
expyriment/expyriment
[ 106, 37, 106, 6, 1375792731 ]
def is_hex(value): """Check for valid Hex triplet value. Parameters ---------- value : string (e.g. "#FF0000") the value to be checked Returns ------- valid : bool whether the value is valid or not """ if not isinstance(...
expyriment/expyriment
[ 106, 37, 106, 6, 1375792731 ]
def is_hsv(value): """Check for valid HSV tuple value. Parameters ---------- value : iterable of length 3 (e.g. [0, 100, 100]) the value to be checked Returns ------- valid : bool whether the value is valid or not """ if...
expyriment/expyriment
[ 106, 37, 106, 6, 1375792731 ]
def is_hsl(value): """Check for valid HSL tuple value. Parameters ---------- value : iterable of length 3 (e.g. [0, 100, 50]) the value to be checked Returns ------- valid : bool whether the value is valid or not """ ret...
expyriment/expyriment
[ 106, 37, 106, 6, 1375792731 ]
def is_colour(value): """Check for valid colour value. Parameters ---------- value : any type the value to be checked Returns ------- valid : bool whether the value is valid or not """ return Colour.is_rgb(value) or\ ...
expyriment/expyriment
[ 106, 37, 106, 6, 1375792731 ]
def __str__(self): return "Colour(red={0}, green={1}, blue={2})".format(self._rgb[0], self._rgb[1], self._rgb[2])
expyriment/expyriment
[ 106, 37, 106, 6, 1375792731 ]
def __ne__(self, other): return self._rgb != other._rgb
expyriment/expyriment
[ 106, 37, 106, 6, 1375792731 ]
def __len__(self): return len(self._rgb)
expyriment/expyriment
[ 106, 37, 106, 6, 1375792731 ]
def rgb(self): """Getter for colour in RGB format [red, green, blue].""" return self._rgb
expyriment/expyriment
[ 106, 37, 106, 6, 1375792731 ]
def rgb(self, value): """Setter for colour in RGB format [red, green, blue].""" if Colour.is_rgb(value): self._rgb = tuple(value) else: raise ValueError("'{0}' is not a valid RGB colour!".format(value))
expyriment/expyriment
[ 106, 37, 106, 6, 1375792731 ]
def hex(self): """Getter for colour in Hex format "#RRGGBB".""" return '#{:02X}{:02X}{:02X}'.format(self._rgb[0], self._rgb[1], self._rgb[2])
expyriment/expyriment
[ 106, 37, 106, 6, 1375792731 ]
def hex(self, value): """Setter for colour in Hex format "#RRGGBB".""" if Colour.is_hex(value): c = value.lstrip("#") self._rgb = tuple(int(c[i:i + 2], 16) for i in (0, 2, 4)) else: raise ValueError("'{0}' is not a valid Hex colour!".format(value))
expyriment/expyriment
[ 106, 37, 106, 6, 1375792731 ]
def name(self): """Getter for colour name (if available).""" for name, rgb in _colours.items(): if rgb == self.rgb: return name return None
expyriment/expyriment
[ 106, 37, 106, 6, 1375792731 ]
def name(self, value): """Setter for colour name.""" if Colour.is_name(value): self._rgb = _colours[value.lower()] else: raise ValueError("'{0}' is not a valid colour name!".format(value))
expyriment/expyriment
[ 106, 37, 106, 6, 1375792731 ]
def hsv(self): """Getter for colour in HSV format [hue, saturation, value].""" hsv = colorsys.rgb_to_hsv(*divide(self.rgb, 255.0)) rtn = list(multiply([hsv[0]], 360)) rtn.extend(multiply(hsv[1:], 100)) return rtn
expyriment/expyriment
[ 106, 37, 106, 6, 1375792731 ]
def hsv(self, value): """Setter for colour in HSV format [hue, saturation, value].""" if Colour.is_hsv(value): hsv = list(divide([value[0]], 360)) hsv.extend(divide(value[1:], 100)) self._rgb = multiply(colorsys.hsv_to_rgb(*hsv), 255) else: raise ...
expyriment/expyriment
[ 106, 37, 106, 6, 1375792731 ]
def hsl(self): """Getter for colour in HSL format [hue, saturation, lightness].""" hsl = colorsys.rgb_to_hls(*divide(self.rgb, 255.0)) rtn = list(multiply([hsl[0]], 360)) rtn.extend(multiply(hsl[1:], 100)) return rtn
expyriment/expyriment
[ 106, 37, 106, 6, 1375792731 ]
def hsl(self, value): """Setter for colour in HSL format [hue, saturation, lightness].""" if Colour.is_hsv(value): hsl = list(divide([value[0]], 360)) hsl.extend(divide(value[1:], 100)) self._rgb = multiply(colorsys.hls_to_rgb(*hsl), 255) else: ra...
expyriment/expyriment
[ 106, 37, 106, 6, 1375792731 ]
def multiply(v, d): return tuple(map(lambda x:int(round(x*d)), v))
expyriment/expyriment
[ 106, 37, 106, 6, 1375792731 ]
def __init__(self, world_list, regionset, options, backup_worlds): Cmd.__init__(self) self.world_list = world_list self.regionset = regionset self.world_names = [str(i.name) for i in self.world_list] # if there's only one world use it if len(self.world_list) == 1 and len(...
Fenixin/Minecraft-Region-Fixer
[ 476, 94, 476, 14, 1302184845 ]
def do_set(self, arg): """ Command to change some options and variables in interactive mode """ args = arg.split() if len(args) > 2: print("Error: too many parameters.") elif len(args) == 0: print("Write \'help set\' to see a list of all possible varia...
Fenixin/Minecraft-Region-Fixer
[ 476, 94, 476, 14, 1302184845 ]
def do_current_workload(self, arg): """ Prints the info of the current workload """ if len(arg) == 0: if self.current: print(self.current) else: print("No world/region-set is set! Use \'set workload\' to set a world/regionset to work with.") ...
Fenixin/Minecraft-Region-Fixer
[ 476, 94, 476, 14, 1302184845 ]
def do_count_chunks(self, arg): """ Counts the number of chunks with the given problem and prints the result """ if self.current and self.current.scanned: if len(arg.split()) == 0: print("Possible counters are: {0}".format(self.possible_chunk_args_text)) ...
Fenixin/Minecraft-Region-Fixer
[ 476, 94, 476, 14, 1302184845 ]
def do_count_all(self, arg): """ Print all the counters for chunks and regions. """ if self.current and self.current.scanned: if len(arg.split()) > 0: print("This command doesn't requiere any arguments") else: print("{0:#^60}".format("Chunk problem...
Fenixin/Minecraft-Region-Fixer
[ 476, 94, 476, 14, 1302184845 ]
def do_remove_chunks(self, arg): if self.current and self.current.scanned: if len(arg.split()) == 0: print("Possible arguments are: {0}".format(self.possible_chunk_args_text)) elif len(arg.split()) > 1: print("Error: too many parameters.") else...
Fenixin/Minecraft-Region-Fixer
[ 476, 94, 476, 14, 1302184845 ]
def do_replace_regions(self, arg): el = self.options.entity_limit de = self.options.delete_entities if self.current and self.current.scanned: if len(arg.split()) == 0: print("Possible arguments are: {0}".format(self.possible_region_args_text)) elif len(arg...
Fenixin/Minecraft-Region-Fixer
[ 476, 94, 476, 14, 1302184845 ]
def do_quit(self, arg): print("Quitting.") return True
Fenixin/Minecraft-Region-Fixer
[ 476, 94, 476, 14, 1302184845 ]
def do_EOF(self, arg): print("Quitting.") return True
Fenixin/Minecraft-Region-Fixer
[ 476, 94, 476, 14, 1302184845 ]
def complete_arg(self, text, possible_args): l = [] for arg in possible_args: if text in arg and arg.find(text) == 0: l.append(arg + " ") return l
Fenixin/Minecraft-Region-Fixer
[ 476, 94, 476, 14, 1302184845 ]
def complete_count_chunks(self, text, line, begidx, endidx): possible_args = list(c.CHUNK_PROBLEMS_ARGS.values()) + ['all'] return self.complete_arg(text, possible_args)
Fenixin/Minecraft-Region-Fixer
[ 476, 94, 476, 14, 1302184845 ]
def complete_replace_chunks(self, text, line, begidx, endidx): possible_args = list(c.CHUNK_PROBLEMS_ARGS.values()) + ['all'] return self.complete_arg(text, possible_args)
Fenixin/Minecraft-Region-Fixer
[ 476, 94, 476, 14, 1302184845 ]
def complete_remove_regions(self, text, line, begidx, endidx): possible_args = list(c.REGION_PROBLEMS_ARGS.values()) + ['all'] return self.complete_arg(text, possible_args)
Fenixin/Minecraft-Region-Fixer
[ 476, 94, 476, 14, 1302184845 ]
def help_set(self): print("\nSets some variables used for the scan in interactive mode. " "If you run this command without an argument for a variable " "you can see the current state of the variable. You can set:\n" " verbose\n" "If True prints a line pe...
Fenixin/Minecraft-Region-Fixer
[ 476, 94, 476, 14, 1302184845 ]
def help_scan(self): print("\nScans the current world set or the region set.\n")
Fenixin/Minecraft-Region-Fixer
[ 476, 94, 476, 14, 1302184845 ]
def help_remove_entities(self): print("\nRemove all the entities in chunks that have more than entity-limit entities.") print() print("This chunks are the ones with status \'too many entities\'.\n")
Fenixin/Minecraft-Region-Fixer
[ 476, 94, 476, 14, 1302184845 ]
def help_replace_chunks(self): print("\nReplaces bad chunks with the given status using the backups directories.") print() print("Exampe: \"replace_chunks corrupted\"") print() print("this will replace the corrupted chunks with the given backups.") print() print("...
Fenixin/Minecraft-Region-Fixer
[ 476, 94, 476, 14, 1302184845 ]
def help_remove_regions(self): print("\nRemoves regions with the given status.") print() print("Example: \'remove_regions too-small\'") print() print("this will remove the region files with status \'too-small\'.") print() print("Possible status are: {0}".format(se...
Fenixin/Minecraft-Region-Fixer
[ 476, 94, 476, 14, 1302184845 ]
def help_summary(self): print("\nPrints a summary of all the problems found in the current workload.\n")
Fenixin/Minecraft-Region-Fixer
[ 476, 94, 476, 14, 1302184845 ]
def help_EOF(self): print("\nQuits interactive mode, exits region-fixer. Same as \'quit\' and \'exit\' commands\n")
Fenixin/Minecraft-Region-Fixer
[ 476, 94, 476, 14, 1302184845 ]
def get_source_ip(my_request): try: # First check for an X-Forwarded-For header provided by a proxy / router e.g. on Heroku source_ip = my_request.headers['X-Forwarded-For'] except KeyError: try: # First check for an X-Forwarded-For header provided by a proxy / router e.g. on...
open-ods/open-ods
[ 3, 2, 3, 18, 1446219918 ]
def get_request_id(my_request): try: request_id = my_request.headers['X-Request-Id'] except KeyError: request_id = str(uuid.uuid4()) g.request_id = request_id return request_id
open-ods/open-ods
[ 3, 2, 3, 18, 1446219918 ]
def print_(arg): """ Args: arg: la valeur à afficher Returns: la valeur à afficher ainsi qu'une série de '-', afin d'espacer l'affichage """ print(arg) print("-------------------------------------")
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def __init__(self, nom_table): super().__init__() self.nom_table = nom_table
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def __init__(self, y, site_web, identifiant, mdp, categorie, objet, nom_table): self.position = y self.objet = objet self.nom_site = site_web self.nom_mdp = mdp self.nom_cat = categorie self.nom_table = nom_table self.ligne = QtWidgets.QHBoxLayout() self.site_web =QtWidgets.QLabel() self.site_web.set...
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def changement_pwd(self): requete ="SELECT mdp FROM sites_reconnus_"+self.nom_table+" WHERE rowid=?" ancien_mdp = toliste(bdd_select(requete, (self.position+1,)))[0] # On ajoute le site_web sous le mdp correspondant requete= "UPDATE sites_reconnus_"+self.nom_table+" SET mdp=? WHERE rowid=?" nouveau_mdp = sel...
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def afficher_combo_pwd(self): requete= "SELECT mdp FROM mdps_"+self.nom_table+"" tab = bdd_select(requete) result = [] for k in range(len(tab)): result.append(tab[k][0]) self.mdp.addItem(self.nom_mdp) for pwd in result: if pwd and pwd != self.nom_mdp: self.mdp.addItem(pwd) if(self.n...
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def __init__(self, position, nom, sites_lies, objet, nom_table): self.position = position self.nom = nom self.sites_lies = sites_lies self.objet = objet self.nom_table =nom_table self.ligne = QtWidgets.QHBoxLayout() self.pushButton = QtWidgets.QPushButton() self.pushButton.setMinimumSize(QtCore.QSize...
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def msgbtn(self, buttonClicked): if(buttonClicked.text() == "Oui"): self.suppression()
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def affichage_sites_lies(self, site_lies): pass
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def __init__(self, position, nom, sites_lies, objet, nom_table): # On exécute Ligne.__init__() super().__init__(position, nom, sites_lies, objet, nom_table) # On ajoute d'autres attributs/propriétés self.ligne.setObjectName("ligne_categorie") self.groupBox.setObjectName("groupBox_cat") self.groupBox.setTitl...
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def affichage_sites_lies(self, sites_lies): for site in sites_lies: label = QtWidgets.QLabel()
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def suppression_bdd(self): requete = "DELETE FROM categories_"+self.nom_table +" WHERE nom_categorie=?" bdd_delete(requete, (self.nom,)) print("Categorie supprimée: "+ self.nom)
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def ajout_combobox(self): for k in range(len(self.objet.sites)): self.objet.sites[k].categorie.addItem(self.nom)
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def __init__(self, position, nom, sites_lies, objet, nom_table): super().__init__(position, nom, sites_lies, objet, nom_table) self.ligne.setObjectName("ligne_pwd") self.groupBox.setObjectName("groupBox_pwd") self.groupBox.setTitle(nom) self.pushButton.setObjectName("pushButton_pwd") # On modifie la couleu...
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def affichage_sites_lies(self, sites_lies): for site in sites_lies: self.label(site)
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def create_text_label(self, couleur, site): texte = "<font size='5' font-style='' color="+couleur+">•</font> " for lettre in site: texte += lettre return(texte)
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def update_color_groupBox(self): colorGroupBox = self.colorHEX if(self.labels != []): if(self.labels[0].colorHEX != "#fff"): colorGroupBox = self.labels[0].colorHEX b = 1 for label in self.labels: if(label.colorHEX != colorGroupBox): b=0 if(not b): colorGroupBox = "#757575" else: ...
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def getColor_label(self, site): """En paramètre le site, retourne un tableau de couleur [RGB, HEX] (associée à la categorie éventuellement assignées """ requete = "SELECT categorie FROM sites_reconnus_"+self.nom_table+" WHERE site_web=?" categorie = toliste(bdd_select(requete, (site,)))[0] tab = ["rgb(255,...
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def suppression_affichage(self): # suppression combobox for k in range(len(self.objet.sites)): if self.objet.sites[k].mdp.currentText() == self.nom: # si le mdp supprimée était celui du site, alors on change le change en le choix vide:"" if self.objet.sites[k].mdp.findText("") == -1: ...
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def __init__(self, fenetre): self.setupUi(fenetre) self.ajouter_cat.setPlaceholderText("Ajouter une catégorie") self.ajouter_pwd.setPlaceholderText("Ajouter un mot de passe") self.lineEdit_ajout_site.setPlaceholderText("Ajouter un site web") # Evènements self.ajouter_cat.returnPressed.connect(self.check_i...
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def setupMenu(self): self.aide_url = "https://github.com/MindPass/Code/wiki/Aide" self.apropos_url ="https://github.com/MindPass/Code" self.actionObtenir_de_l_aide.triggered.connect(self.ouvrirAide) self.actionA_propos_de_MindPass.triggered.connect(self.ouvrirApropos) """ self.actionMode_deux_lettres.trig...
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def check_deux_lettres(self): self.actionMode_deux_lettres.setChecked(True) self.actionMode_complet.setChecked(False) self.menuAffichage()
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def menuAffichage(self): if(self.actionMode_deux_lettres.isChecked()): self.affichage_deux_lettres() else: self.affichage_complet()
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def affichage_complet(self): for pwd in self.pwds: pwd.update_title(pwd.nom) for site in self.sites: site.update_pwd_combobox(1)
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def ouvrirAide(self): self.openURL(self.aide_url)
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def openURL(self, given_url): url = QtCore.QUrl(given_url) if not QtGui.QDesktopServices.openUrl(url): QtGui.QMessageBox.warning(self, "Open Url", "Could not open url")
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def actualiser_couleur(self): nb_cat = len(self.cats) for i in range(nb_cat): self.cats[i].setColor(i, nb_cat)
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def ajouter_categorie(self): requete ="INSERT INTO categories_"+self.nom_table +" (nom_categorie) VALUES(?)" bdd_insert(requete, (self.ajouter_cat.displayText(),)) #ajout dans les combobox for k in range(len(self.sites)): self.sites[k].categorie.addItem(self.ajouter_cat.displayText()) # ajout de la catég...
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def check_if_exist_pwd(self): """ Vérifier que le pwd en question n'est pas déjà dans la base de donnée """ if self.ajouter_pwd.displayText() != "": requete = "SELECT mdp FROM mdps_"+self.nom_table+" WHERE mdp=?" pwds_table = bdd_select(requete, (self.ajouter_pwd.displayText(),)) conditions = ...
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def ajouter_password(self): requete = "INSERT INTO mdps_"+self.nom_table+" (mdp) VALUES(?)" bdd_insert(requete, (self.ajouter_pwd.displayText(),)) #ajout dans les combobox for k in range(len(self.sites)): self.sites[k].mdp.addItem(self.ajouter_pwd.displayText()) # ajout dans la ScrollArea Passwords sel...
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def actualiser_couleur_pwd(self): # destruction des layouts dans la scroll_area self.scrollAreaWidgetContents_pwd.deleteLater() # on vide les attributs self.pwds = [] # On en recrée un vide self.scrollAreaWidgetContents_pwd = QtWidgets.QWidget() self.scrollAreaWidgetContents_pwd.setGeometry(QtCore.QRect(0...
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def check_new_site(self): requete = "SELECT site_web FROM sites_reconnus_"+self.nom_table+"" sites_web = toliste(bdd_select(requete)) if(self.lineEdit_ajout_site.text() not in sites_web and self.lineEdit_ajout_site.text() != ""): requete = "INSERT INTO sites_reconnus_"+self.nom_table+" VALUES(?,?,?,?,?)" ...
MindPass/Code
[ 4, 1, 4, 1, 1450227435 ]
def __init__(self, jds, mags, magerrs, splitup=True, deltat=0.000001, sort=True, stab=False, stabext=300.0, stabgap = 30.0, stabstep = 5.0, stabmagerr = -2.0, stabrampsize = 0, stabrampfact = 1.0): """ Constructor Always leave splitup and sort on True ! Only if you know that you are already sorted you can sk...
COSMOGRAIL/PyCS
[ 4, 4, 4, 14, 1454429374 ]
def splitup(self): """ TO WRITE !!! We avoid that two points get the same jds... Note that this might change the order of the jds, but only of very close ones, so one day it would be ok to leave the mags as they are.
COSMOGRAIL/PyCS
[ 4, 4, 4, 14, 1454429374 ]
def sort(self): """ Absolutely mandatory, called in the constructor. """ sortedindices = np.argsort(self.jds) self.jds = self.jds[sortedindices] self.mags = self.mags[sortedindices] self.magerrs = self.magerrs[sortedindices] self.mask = self.mask[sortedindices] self.validate()
COSMOGRAIL/PyCS
[ 4, 4, 4, 14, 1454429374 ]
def validate(self): """ We check that the datapoint jds are increasing strictly : """ first = self.jds[:-1] second = self.jds[1:] if not np.alltrue(np.less(first,second)): # Not less_equal ! Strictly increasing ! raise RuntimeError, "These datapoints don't have strcitly increasing jds !"
COSMOGRAIL/PyCS
[ 4, 4, 4, 14, 1454429374 ]
def rmstab(self): """ Deletes all stabilization points """ self.jds = self.jds[self.mask] self.mags = self.mags[self.mask] self.magerrs = self.magerrs[self.mask] self.mask = np.ones(len(self.jds), dtype=np.bool)
COSMOGRAIL/PyCS
[ 4, 4, 4, 14, 1454429374 ]
def putstab(self): """ Runs only if stab is True. I will : add datapoints (new jds, new mags, new magerrs) modify the mask = False for all those new datapoints. """ if self.stab == True:
COSMOGRAIL/PyCS
[ 4, 4, 4, 14, 1454429374 ]
def calcstabmagerr(self): """ Computes the mag err of the stabilisation points. """ if self.stabmagerr >= 0.0: return self.stabmagerr else: return - self.stabmagerr * np.median(self.magerrs)
COSMOGRAIL/PyCS
[ 4, 4, 4, 14, 1454429374 ]
def addgappts(self): """ We add stabilization points with low weights into the season gaps to avoid those big excursions of the splines. This is done by a linear interpolation across the gaps. """
COSMOGRAIL/PyCS
[ 4, 4, 4, 14, 1454429374 ]
def addextpts(self): """ We add stabilization points at both extrema of the lightcurves This is done by "repeating" the extremal points, and a ramp in the magerrs """
COSMOGRAIL/PyCS
[ 4, 4, 4, 14, 1454429374 ]
def getmaskbounds(self): """ Returns the upper and lower bounds of the regions containing stabilization points. This is used when placing knots, so to put fewer knots in these regions. Crazy stuff... """
COSMOGRAIL/PyCS
[ 4, 4, 4, 14, 1454429374 ]
def ntrue(self): """ Returns the number of real datapoints (skipping stabilization points) """ return np.sum(self.mask)
COSMOGRAIL/PyCS
[ 4, 4, 4, 14, 1454429374 ]
def __init__(self, datapoints, t = None, c = None, k = 3, bokeps = 2.0, boktests = 5, bokwindow = None, plotcolour="black"): """ t : all the knots (not only internal ones !) c : corresponding coeffs k : degree : default = cubic splines k=3 -> "order = 4" ??? whatever ... 3 means that you can differentiate twi...
COSMOGRAIL/PyCS
[ 4, 4, 4, 14, 1454429374 ]
def __str__(self): """ Returns a string with: * degree * knot placement * number of intervals
COSMOGRAIL/PyCS
[ 4, 4, 4, 14, 1454429374 ]
def copy(self): """ Returns a "deep copy" of the spline. """ return pythoncopy.deepcopy(self)
COSMOGRAIL/PyCS
[ 4, 4, 4, 14, 1454429374 ]
def shifttime(self, timeshift): """ Hard-shifts your spline along the time axis. By "hard-shift", I mean that unlike for a lightcurve, the spline will not know that it was shifted ! It's up to you to be sure that you want to move it. We shift both the datapoints and the knots. """ self.t += timeshift s...
COSMOGRAIL/PyCS
[ 4, 4, 4, 14, 1454429374 ]
def updatedp(self, newdatapoints, dpmethod="stretch"): """
COSMOGRAIL/PyCS
[ 4, 4, 4, 14, 1454429374 ]
def uniknots(self, nint, n=True): """ Uniform distribution of internal knots across the datapoints (including any stab points). We don't make a difference between stab and real points.
COSMOGRAIL/PyCS
[ 4, 4, 4, 14, 1454429374 ]
def resetc(self): """ Sets all coeffs to 0.0 -- if you want to start again your fit, keeping the knot positions. """ self.c = np.zeros(len(self.t))
COSMOGRAIL/PyCS
[ 4, 4, 4, 14, 1454429374 ]
def reset(self): """ Calls uniknots, i.e. resets both coeffs and knot positions, keeping the same number of knots. """ self.uniknots(self.getnint() ,n=True)
COSMOGRAIL/PyCS
[ 4, 4, 4, 14, 1454429374 ]