query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Show employee a level below
def employees_json_id(request, employee_id): curent_employee = Employee.objects.get(pk=int(employee_id)) if curent_employee.is_manager: employee_list = Employee.objects.filter(manager=curent_employee) employees = list() for employee in employee_list: manager_dict = model_to_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_level_exp_mouseover(self):\n if self.skill_tree_displaying:\n return\n self.tooltip_focus = self.level_and_exp_rect\n player_panel_renderer.draw_exp_details(self.player_dict['experience'])", "def getEmployeeLevel(self,number:int):\n allLevels = [1,2,3,4]\n ...
[ "0.6092373", "0.60603535", "0.5886119", "0.5763377", "0.57354516", "0.5616083", "0.5597218", "0.556029", "0.55143595", "0.55038935", "0.5442811", "0.54350245", "0.5397879", "0.53973335", "0.5397157", "0.53344226", "0.53100413", "0.529323", "0.52915984", "0.52886397", "0.52444...
0.0
-1
Get all employees manager as json
def employees_manager(request): # current_employee = Employee.objects.get(user__pk=request.user.pk) manager_list = Employee.objects.filter(manager=request.user.employee_user, is_manager=True) employee = Employee.objects.get(pk=request.user.employee_user.id) employee_dict = model_to_dict(employee) em...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_manager_employees(request):\n current_employee = Employee.objects.get(user__pk=request.user.pk)\n manager_employees = Employee.objects.filter(manager=current_employee, development_plan_type=None).all()\n if manager_employees:\n emp_list=[]\n for emp in manager_employees:\n ...
[ "0.80657506", "0.79710835", "0.74464977", "0.7288061", "0.7011785", "0.6977914", "0.6967183", "0.6929463", "0.69241434", "0.6900269", "0.67404765", "0.66503465", "0.64858013", "0.6479257", "0.64647675", "0.6463374", "0.63625044", "0.6354452", "0.6331073", "0.6328877", "0.6321...
0.7887314
2
Securely download files from user.
def employee_delete_file(request, employee_id, filename): current_user = Employee.objects.get(user__pk=request.user.pk) if not current_user.hasAccessTo(employee_id): logUnauthorizedAccess( "User tried to delete file he didnt have access to", request, filename ) return HttpR...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restricted_download():\n aaa.require(fail_redirect='/login')\n return bottle.static_file('static_file', root='.')", "def download_files(self):", "def download_file(self, net_id, request_id, file_name):\n current_user_roles = get_user_roles()\n if current_user_roles[\"STFADM\"] or net_id...
[ "0.6933737", "0.67762506", "0.6603779", "0.65035725", "0.6269322", "0.6244334", "0.6117313", "0.6104816", "0.6099837", "0.60964644", "0.6042637", "0.60026896", "0.59894454", "0.59013104", "0.58944786", "0.5857168", "0.58530647", "0.58518803", "0.5833485", "0.5799934", "0.5795...
0.0
-1
Securely download files from user.
def employee_download_file(request, employee_id, filename): current_user = Employee.objects.get(user__pk=request.user.pk) if not current_user.hasAccessTo(employee_id): logUnauthorizedAccess( "User tried to download file he didnt have access to", request, filename ) return H...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restricted_download():\n aaa.require(fail_redirect='/login')\n return bottle.static_file('static_file', root='.')", "def download_files(self):", "def download_file(self, net_id, request_id, file_name):\n current_user_roles = get_user_roles()\n if current_user_roles[\"STFADM\"] or net_id...
[ "0.6934367", "0.6775749", "0.6602642", "0.6503681", "0.626969", "0.62442297", "0.6117034", "0.6105623", "0.6099257", "0.6096529", "0.6040991", "0.60035723", "0.59876895", "0.5901248", "0.58960354", "0.58567363", "0.5854076", "0.5851294", "0.5834396", "0.5800784", "0.57954973"...
0.5542597
86
View for detail of employee
def employee_detail(request, employee_id): current_employee = Employee.objects.get(user__pk=request.user.pk) employee = Employee.objects.get(pk=int(employee_id)) if not current_employee.isEnsoUser() and current_employee.company.pk != employee.company.pk: raise PermissionDenied() actions = employ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def employee(employee_id):\n # gather data from db about all employees\n return render_template(\"employee.html\",\n employee_id=employee_id)", "def employee():\n return Response(render_template('employee/employee.html'))", "def employees():\n # gather data from db about a...
[ "0.7529937", "0.7131289", "0.71110165", "0.6999811", "0.6908806", "0.6881819", "0.66219467", "0.6529428", "0.6462217", "0.64600676", "0.6398058", "0.6358623", "0.6351768", "0.63481253", "0.6347821", "0.63392276", "0.6267284", "0.623935", "0.6234159", "0.6226198", "0.6206023",...
0.68222797
6
View for all employees current user is a manager for with empty development plan
def get_manager_employees(request): current_employee = Employee.objects.get(user__pk=request.user.pk) manager_employees = Employee.objects.filter(manager=current_employee, development_plan_type=None).all() if manager_employees: emp_list=[] for emp in manager_employees: emp_data={...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_user_development_plans_for_manager(request, employee_id):\n current_employee = Employee.objects.get(user__pk=request.user.pk)\n user_development_plans = DevelopmentPlan.objects.filter(employee_relation=current_employee).all()\n employee = Employee.objects.filter(pk=int(employee_id)).first()\n\...
[ "0.7106553", "0.6753194", "0.674842", "0.6595502", "0.6566336", "0.63812053", "0.61806154", "0.61537486", "0.612033", "0.60830206", "0.60527897", "0.60266685", "0.596054", "0.5893149", "0.5841044", "0.57119644", "0.56820273", "0.56635785", "0.5655162", "0.5615645", "0.5613845...
0.73281884
0
View for detail of employee
def profile_detail(request, employee_id): current_employee = Employee.objects.filter(user__pk=request.user.pk).first() employee = Employee.objects.get(pk=int(employee_id)) if not current_employee: raise PermissionDenied("You don't have any employee assigned to you.", 401) if not current_employ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def employee(employee_id):\n # gather data from db about all employees\n return render_template(\"employee.html\",\n employee_id=employee_id)", "def employee():\n return Response(render_template('employee/employee.html'))", "def employees():\n # gather data from db about a...
[ "0.75270534", "0.71302915", "0.71097803", "0.6996392", "0.6907323", "0.6882247", "0.6820251", "0.6622057", "0.65266895", "0.6458678", "0.63968426", "0.6358651", "0.6349126", "0.63481754", "0.6346942", "0.63395876", "0.62652826", "0.62371093", "0.6237032", "0.6230674", "0.6204...
0.6460907
9
View for creating employee in company
def create_employee(request, company_id): company = Company.objects.get(pk=company_id) current_employee = Employee.objects.get(user__pk=request.user.pk) if not current_employee.isEnsoUser() and current_employee.company.pk != company.pk: logUnauthorizedAccess("User tried to create_employee", request...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_leader_model(request, company_id):\n\n errors = {'noactions': []}\n company = Company.objects.get(pk=company_id)\n currentEmpl = Employee.objects.get(user__pk=request.user.pk)\n \"\"\":type : Employee \"\"\"\n\n if not currentEmpl.isEnsoUser() and currentEmpl.company.pk != company.pk:\n ...
[ "0.6837375", "0.67006433", "0.66819894", "0.6620597", "0.6475171", "0.64458215", "0.6421396", "0.6402227", "0.6344205", "0.6299245", "0.626302", "0.6249063", "0.6230102", "0.6173451", "0.61211884", "0.6115985", "0.60931104", "0.6089694", "0.60648185", "0.60492533", "0.6024815...
0.8076184
0
View for creating many employees in company
def create_many_employees(request, company_id=None): company = Company.objects.get(pk=company_id) current_employee = Employee.objects.get(user__pk=request.user.pk) if not current_employee.isEnsoUser() and current_employee.company.pk != company.pk: raise PermissionDenied() if "upload" in request....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_employee(request, company_id):\n\n company = Company.objects.get(pk=company_id)\n current_employee = Employee.objects.get(user__pk=request.user.pk)\n if not current_employee.isEnsoUser() and current_employee.company.pk != company.pk:\n logUnauthorizedAccess(\"User tried to create_employe...
[ "0.72610486", "0.6829904", "0.6690067", "0.6635526", "0.6073183", "0.60264933", "0.6014927", "0.5973413", "0.5951959", "0.5936964", "0.59301126", "0.578499", "0.57461524", "0.5707354", "0.56899834", "0.5680803", "0.56750655", "0.56400555", "0.5560561", "0.55447835", "0.554248...
0.67414385
2
View for editing employee
def edit_employee(request, employee_id): employee = Employee.objects.get(pk=int(employee_id)) current_employee = Employee.objects.get(user__pk=request.user.pk) assert isinstance(employee, Employee) assert isinstance(current_employee, Employee) # if not current_employee.isEnsoUser() and current_emp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_employee(employee_id):\n\n if not g.user:\n flash(\"Please login to access\", \"danger\")\n return redirect(\"/\")\n \n if g.user.is_admin == False:\n flash (\"Unauthorized\", \"danger\")\n return redirect(\"/login\")\n\n employee = Employee.query.get_or_404(employe...
[ "0.7485564", "0.6978975", "0.6902276", "0.6840151", "0.6783405", "0.6756372", "0.66953164", "0.66938245", "0.66192317", "0.65741867", "0.65598595", "0.65310377", "0.6502672", "0.6400611", "0.6391832", "0.6368707", "0.63276947", "0.6300049", "0.6295493", "0.62654054", "0.62085...
0.7715588
0
View of dashboard containing overview of relevant information
def dashboard(request): employee = request.user.employee_user.first() widgets = list() # development_plans = employee.getDevelopmentPlans() if employee.is_manager: widgets.append(dict( # template="mus/_widget_waiting_developmentplans.html", data=employee.getMyEmployees(),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dashboard():", "def dashboard():\n # Get current user\n user = current_user\n # Get tip of the day\n tip = gdb.gettipofday()\n # Get current user Leaderboard Status\n leaderboard, current_user_info = gdb.getleaderboard(current_user.userID)\n weektopgainers, monthtopgainers = gdb.gettopga...
[ "0.8157949", "0.7479624", "0.738469", "0.7263216", "0.72455734", "0.7196145", "0.7135433", "0.7082106", "0.7069867", "0.7064431", "0.7064215", "0.70062995", "0.6955068", "0.68793905", "0.68734276", "0.6863764", "0.6852004", "0.68505263", "0.6806025", "0.67434174", "0.67335117...
0.6533786
25
View for list of actions of (current) employee
def action_list(request, employee_id=None): if employee_id: employee = Employee.objects.get(pk=employee_id) current_employee = Employee.objects.get(user__pk=request.user.pk) if not current_employee.isEnsoUser() and current_employee.company.pk != employee.company.pk: raise Permiss...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_overview_of_all_employees(self):\n\n print(\"OVERVIEW OF EMPLOYEES\\n\")\n\n employees_ob_list = self.llapi.get_employee_overview()\n \n for employee_ob in employees_ob_list:\n print(employee_ob.print_info_in_line(\"*\"))\n \n print(f\"\\nNAN AI...
[ "0.6613559", "0.63822025", "0.6160403", "0.61327785", "0.61140096", "0.5988209", "0.5908296", "0.5907843", "0.5899233", "0.5892363", "0.5886298", "0.58746743", "0.58155996", "0.57719344", "0.5768285", "0.5741835", "0.5715916", "0.57119167", "0.5709055", "0.5664173", "0.561676...
0.8160547
0
View for editing action
def action_edit(request, action_id): employee = request.user.employee_user.first() action = Action.objects.get(pk=action_id) if not employee.isEnsoUser() and employee.company.pk != action.employee.company.pk: raise PermissionDenied() # if request.method == 'POST': form = ActionForm(request.P...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit(self):\n\n pass", "def edit(self, **kwargs):\n ...", "def edit_form():\n return template (\"edit\")", "def edit():", "def edit_person(self, pk):", "def edit(self, *args, **kw):\n\t\t\ttmpl_context.widget = self.edit_form\n\t\t\tpks \t\t= self.provider.get_primary_fields(self.mod...
[ "0.80914015", "0.78752905", "0.7775213", "0.7495747", "0.74247116", "0.73104566", "0.7053273", "0.7040553", "0.7038563", "0.69779855", "0.6973604", "0.6886933", "0.68703216", "0.68322045", "0.67837024", "0.6779167", "0.67466205", "0.6741481", "0.6699304", "0.6675047", "0.6622...
0.74116254
5
View for detail of action
def action_detail(request, action_id): employee = request.user.employee_user.first() action = Action.objects.get(pk=int(action_id)) # if not employee.isEnsoUser() and employee.company.pk != action.employee.company.pk: if not employee.hasAccessTo(action.employee): raise PermissionDenied() if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return _action_args_dict[self.action].name", "def action(self):\n pass", "def action(self):\n pass", "def view(self):", "def get_action(self, context):\n pass", "def show(self, *args, **kwargs) -> None:\n pass", "def show(self, *args, **kwargs) ->...
[ "0.67003417", "0.6600345", "0.6600345", "0.6525399", "0.6474398", "0.6430569", "0.6430569", "0.6430569", "0.6398873", "0.6335036", "0.62369657", "0.62285584", "0.6216931", "0.6206771", "0.61830616", "0.61691725", "0.6162804", "0.6153047", "0.61520946", "0.60394746", "0.602984...
0.73323816
0
View for creating action
def action_add(request, employee_id=None): if employee_id: employee = Employee.objects.get(pk=employee_id) current_employee = Employee.objects.get(user__pk=request.user.pk) if not current_employee.isEnsoUser() and current_employee.company.pk != employee.company.pk: raise Permissi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def goto_create(self):\n\n self.create.click()", "def create(self):", "def create(self, *args, **kwargs):\n pass", "def create(self):\n ...", "def new_result():\n return ActionResult()", "def create_view(request, title, modelform, **kwargs):\n instance_form = modelform(requ...
[ "0.6654641", "0.6543866", "0.6499162", "0.6441966", "0.64285094", "0.63419896", "0.6320924", "0.630966", "0.6293948", "0.6293948", "0.62471634", "0.6235429", "0.620226", "0.61985743", "0.6198156", "0.6169896", "0.6168643", "0.6168643", "0.6168643", "0.61534095", "0.6133898", ...
0.0
-1
Create a leader model for employees
def create_leader_model(request, company_id): errors = {'noactions': []} company = Company.objects.get(pk=company_id) currentEmpl = Employee.objects.get(user__pk=request.user.pk) """:type : Employee """ if not currentEmpl.isEnsoUser() and currentEmpl.company.pk != company.pk: raise Permiss...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle(self, *args, **kwargs):\n seeder = Seed.seeder()\n seeder.add_entity(User, 20)\n\n seeder.add_entity(EmployeeMptt, 20, {\n 'user': lambda x: User.objects.filter(employeemptt=None).first(),\n 'parent': lambda x: EmployeeMptt.objects.order_by(\"?\").first(),\n ...
[ "0.65373933", "0.6418469", "0.6274147", "0.6274147", "0.60241544", "0.5993524", "0.5734152", "0.56874007", "0.5683928", "0.5643717", "0.5590358", "0.55775136", "0.55295014", "0.5501056", "0.54992604", "0.5479858", "0.53781486", "0.535312", "0.5326933", "0.52975243", "0.529675...
0.63167363
2
Create LeaderModel and send it as a PDF to the browser
def get_leader_model_pdf(currentEmpl, employees): lm = LeaderModel() employee_actions = {} legend = [] colors = {} errors = {'noactions': []} # numbered_actions = {} for empl in employees: if not currentEmpl.hasAccessTo(empl): raise PermissionDenied() actions ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_leader_model(request, company_id):\n\n errors = {'noactions': []}\n company = Company.objects.get(pk=company_id)\n currentEmpl = Employee.objects.get(user__pk=request.user.pk)\n \"\"\":type : Employee \"\"\"\n\n if not currentEmpl.isEnsoUser() and currentEmpl.company.pk != company.pk:\n ...
[ "0.67373437", "0.63020295", "0.6226293", "0.6087851", "0.5910283", "0.58224714", "0.57705843", "0.5737507", "0.5713494", "0.56827766", "0.5535205", "0.55348325", "0.5490096", "0.54388666", "0.5369891", "0.53277147", "0.52944934", "0.52798676", "0.5266541", "0.5252111", "0.524...
0.71051025
0
View for employee development plan details
def development_plan_details(request, development_plan_id): #, employee_id ): # employee = Employee.objects.get(user__pk=request.user.pk) # employee = Employee.objects.filter(pk=int(employee_id)).first() development_plan = DevelopmentPlan.objects.get(pk=int(development_plan_id)) current_employee = Empl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_active_development_plan_for_user(request):\n current_employee = Employee.objects.get(user__pk=request.user.pk)\n current_development_plan = DevelopmentPlan.objects.filter(\n employee_relation=current_employee,\n employee_relation__developmentplantoemployeerelation__finished_at__isnull=T...
[ "0.6865501", "0.6419754", "0.64083785", "0.6235996", "0.6046271", "0.60325843", "0.60079944", "0.5864522", "0.5858046", "0.58436126", "0.5818266", "0.57469684", "0.5691461", "0.5501445", "0.54863083", "0.5485314", "0.5460011", "0.54553616", "0.54523605", "0.5448519", "0.54469...
0.68573505
1
View a list of user's development plans for manager
def get_all_user_development_plans_for_manager(request, employee_id): current_employee = Employee.objects.get(user__pk=request.user.pk) user_development_plans = DevelopmentPlan.objects.filter(employee_relation=current_employee).all() employee = Employee.objects.filter(pk=int(employee_id)).first() if no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_development_plans_for_user(request):\n current_employee = Employee.objects.get(user__pk=request.user.pk)\n user_development_plans = DevelopmentPlan.objects.filter(employee_relation=current_employee).all()\n\n if not current_employee:\n raise PermissionDenied(\"You don't have any employe...
[ "0.7063593", "0.682502", "0.6374027", "0.6217655", "0.61145437", "0.610118", "0.6058615", "0.59781164", "0.5932294", "0.5915161", "0.59006524", "0.587544", "0.5792681", "0.57351124", "0.5670701", "0.5654031", "0.5596579", "0.5595037", "0.55796534", "0.55656326", "0.552241", ...
0.6848171
1
View a list of development plans for active user
def get_all_development_plans_for_user(request): current_employee = Employee.objects.get(user__pk=request.user.pk) user_development_plans = DevelopmentPlan.objects.filter(employee_relation=current_employee).all() if not current_employee: raise PermissionDenied("You don't have any employee assigned ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_active_development_plan_for_user(request):\n current_employee = Employee.objects.get(user__pk=request.user.pk)\n current_development_plan = DevelopmentPlan.objects.filter(\n employee_relation=current_employee,\n employee_relation__developmentplantoemployeerelation__finished_at__isnull=T...
[ "0.69843084", "0.6867608", "0.6754407", "0.65818614", "0.6510022", "0.64818734", "0.62669057", "0.6181612", "0.6179575", "0.6045006", "0.6030298", "0.60151047", "0.60096705", "0.59797555", "0.5899104", "0.5885478", "0.58685434", "0.5831174", "0.5770537", "0.57329553", "0.5725...
0.7084471
0
View active development plan for active user
def get_active_development_plan_for_user(request): current_employee = Employee.objects.get(user__pk=request.user.pk) current_development_plan = DevelopmentPlan.objects.filter( employee_relation=current_employee, employee_relation__developmentplantoemployeerelation__finished_at__isnull=True).firs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plan_get(request):\n company = auth_api_key(request)\n plan = get_and_check_plan(request, company)\n return plan", "def plans(self):\n title = self.context.Title()\n return self.portal_catalog(portal_type='Plan', Subject=title)", "def get_all_development_plans_for_user(request):\n ...
[ "0.6693725", "0.66212505", "0.6312085", "0.61751384", "0.61356807", "0.60612977", "0.60564137", "0.59662765", "0.5901057", "0.58823967", "0.5879139", "0.585081", "0.58050555", "0.57663673", "0.5763864", "0.57417154", "0.5737406", "0.57106596", "0.57047117", "0.56790864", "0.5...
0.6910045
0
Get or Update goal by id
def self_goal_by_id(request, goal_id): current_user = request.user fields_map = { 'goal_answers': lambda g: [ { 'id': answ.id, 'title': answ.title, "created_by": answ.created_by.username, "created_at": answ.created_at, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def goal(self, goal_id):\r\n return goals.Goal(self, goal_id)", "def goal(self, goal_id):\r\n return Goal(self, goal_id)", "def getById(self, id_goals):\n lparam = [id_goals]\n rep = AbstractDAO._read(self, R_READBYID, lparam)\n return self.__fetch_to_object(rep, True)", "d...
[ "0.68321764", "0.6705152", "0.6541664", "0.6067706", "0.6032877", "0.6005164", "0.59921056", "0.5976328", "0.59698373", "0.5885591", "0.58422995", "0.58416253", "0.5819017", "0.5806884", "0.58029574", "0.5794082", "0.57710695", "0.57252264", "0.57099134", "0.56292725", "0.562...
0.67704624
1
Get or Update goal's answer by id
def set_get_answer(request, answer_id): current_user = request.user fields = ["created_by", "title", "created_at", 'id', 'file'] fields_map = { "created_by": lambda a: a.created_by.username, "file": lambda a: a.file.url if a.file else '' } answ = GoalAnswer.objects.get(pk=answer_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def self_goal_by_id(request, goal_id):\n current_user = request.user\n\n fields_map = {\n 'goal_answers': lambda g: [\n {\n 'id': answ.id,\n 'title': answ.title,\n \"created_by\": answ.created_by.username,\n \"created_at\": answ.cr...
[ "0.6852361", "0.6565505", "0.5933789", "0.5877702", "0.58608663", "0.5800607", "0.57284534", "0.5717084", "0.5700604", "0.5696132", "0.5641497", "0.5632813", "0.56148297", "0.5601214", "0.55787456", "0.5564735", "0.5534567", "0.549483", "0.5468139", "0.5458586", "0.54545426",...
0.653086
2
Tokenization/string cleaning for all datasets except for SST.
def clean_str(string): string = re.sub(r"[^A-Za-z0-9(),!?\'\`]", " ", string) string = re.sub(r"\'re", " \'re", string) string = re.sub(r"\'d", " \'d", string) string = re.sub(r"\'ll", " \'ll", string) string = re.sub(r",", " , ", string) string = re.sub(r"!", " ! ", string) string = re.sub(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleaning (data):", "def clean_data(self, data):\r\n data=data.lower()\r\n doc=nlp(data, disable=['parser', 'ner'])\r\n \r\n #Removing stopwords, digits and punctuation from data\r\n tokens = [token.lemma_ for token in doc if not (token.is_stop\r\n ...
[ "0.66215855", "0.61963105", "0.61640877", "0.6127651", "0.6074511", "0.6014394", "0.59874463", "0.5976716", "0.5957324", "0.59493726", "0.59331477", "0.59058803", "0.5905406", "0.59032536", "0.5874476", "0.58563834", "0.584708", "0.58449286", "0.58449286", "0.5819846", "0.579...
0.0
-1
Builds a vocabulary mapping from word to index based on the sentences. Returns vocabulary mapping and inverse vocabulary mapping.
def build_vocab(sentences): # Build vocabulary word_counts = Counter(itertools.chain(*sentences)) # Mapping from index to word vocabulary_inv = [x[0] for x in word_counts.most_common()] # Mapping from word to index vocabulary = {x: i for i, x in enumerate(vocabulary_inv)} return [vocabulary,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_vocab(self, sentences):\n\t\t# Build the vocab\n\t\tword_counts = collections.Counter(sentences)\n\n\t\t# Mapping from index to word (get the indices of most common words)\n\t\tvocab_inv = [x[0] for x in word_counts.most_common()] # Do we need this?\n\t\tvocab_inv = list(sorted(vocab_inv))\n\n\t\t# Mapp...
[ "0.796555", "0.78444034", "0.76602143", "0.765326", "0.7552341", "0.74616605", "0.69504786", "0.69184107", "0.68647057", "0.6849758", "0.6777216", "0.6661577", "0.6608296", "0.6554376", "0.6551425", "0.6457603", "0.6450155", "0.6442917", "0.64372295", "0.6427494", "0.6417837"...
0.7715383
4
Maps sentencs and labels to vectors based on a vocabulary.
def build_input_data(sentences, labels, vocabulary, pos1_sentences, pos2_sentences): x = np.array([[vocabulary[word] for word in sentence] for sentence in sentences]) y = np.array(labels) a1 = np.array(pos1_sentences) a2 = np.array(pos2_sentences) return [x, y, a1, a2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_vocab(sentences):\n # Build vocabulary\n word_counts = Counter(itertools.chain(*sentences)) # 实际没用到\n # Mapping from index to word\n vocabulary_inv = [x[0] for x in word_counts.most_common()]\n vocabulary_inv = list(sorted(vocabulary_inv))\n # 加入 <UNK>\n vocabulary_inv.insert(0, '</...
[ "0.7294427", "0.70792955", "0.70614845", "0.700578", "0.700578", "0.700578", "0.699909", "0.69712275", "0.6877698", "0.68140954", "0.6795766", "0.6701864", "0.66283876", "0.6619812", "0.6589712", "0.6576624", "0.65659446", "0.6559201", "0.6493492", "0.648277", "0.64260834", ...
0.58939606
88
Pads all sentences to the same length. The length is defined by the longest sentence. Returns padded sentences.
def pad_sentences(sentences, padding_word="<PAD/>",sequence_length = 0): if sequence_length == 0: sequence_length = max(len(x) for x in sentences) padded_sentences = [] for i in range(len(sentences)): sentence = sentences[i] num_padding = sequence_length - len(sentence) new_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_sentences(sentences, padding_word=\"<PAD/>\"):\n sequence_length = max(len(x) for x in sentences)\n padded_sentences = []\n for i in range(len(sentences)):\n sentence = sentences[i]\n num_padding = sequence_length - len(sentence)\n new_sentence = sentence + [padding_word] * nu...
[ "0.81174576", "0.80845124", "0.8042058", "0.80319756", "0.7986996", "0.76386243", "0.75553435", "0.7518657", "0.7493447", "0.73408186", "0.7043601", "0.7007085", "0.6957604", "0.69015884", "0.6824467", "0.6684047", "0.66429424", "0.6604899", "0.66040134", "0.66006076", "0.660...
0.7942444
5
This function takes a csv file as an argument deduplicates the file and writes the deduplicated dataset to a csv file if a path for the output file is provided as the second argument It returns the deduplicated dataframe Parameters , type, return values
def dataDedup_csv(infile, outfile=None): if fpath.isfile(infile): dataset = pd.read_csv(infile, sep=',', dtype='unicode') dedup_dataset = dataset.drop_duplicates() if outfile!=None: dedup_dataset.to_csv(outfile, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip_duplicates(in_file, out_file, sep_type=\"\", header_rows=0):\n\n util.check_output_dir(out_file)\n\n if header_rows !=0: header=read_header(in_file, num_header_rows=header_rows, sep_type =\"\")\n\n if sep_type==\"\":\n data=pd.read_csv(in_file, skiprows=header_rows, header=None, delim_whi...
[ "0.7729395", "0.6743207", "0.6410341", "0.6338948", "0.6320352", "0.6265429", "0.611104", "0.60951626", "0.6093322", "0.5940891", "0.5861167", "0.57967466", "0.57279533", "0.5659171", "0.5623228", "0.5598873", "0.5594488", "0.5593631", "0.5475531", "0.54566574", "0.5449391", ...
0.78255796
0
This function checks for the size of a dataframe and splits it into parts containing approximately 1 million records as the default number of records for each dataframe.It also provides the option of writing the split dataframes to the disk. Parameters , type, return values
def dataFrameSplit(df, norec=1000000, outfile= None): # calculation of the no. of rows of the dataframe df_rsz = len(df.index) if df_rsz>norec: no_splits = np.ceil(df_rsz/norec) dfarr = np.array_split(df,no_splits) return dfarr else: print(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_dataframe(df, size=10*1024*1024):\n \n # size of each row\n row_size = df.memory_usage().sum() / len(df)\n # maximum number of rows in each segment\n row_limit = int(size // row_size)\n # number of segments\n seg_num = (len(df)+row_limit-1)//row_limit\n # split df into segments\n ...
[ "0.73547655", "0.67736286", "0.6035461", "0.59178704", "0.5877275", "0.58713686", "0.584475", "0.5791403", "0.57895786", "0.5737366", "0.57224447", "0.57164466", "0.5714758", "0.57108814", "0.5700032", "0.5689146", "0.56854934", "0.5663078", "0.5655827", "0.5648846", "0.56323...
0.70206773
1
Configure logging for training log. The format is `log_{log_fname}_{comment}.log` .g. for `train.py`, the log_fname is `log_train.log`. Use `logging.info(...)` to record running log.
def config_logging(comment=None): # Get current executing script name import __main__, os exe_fname=os.path.basename(__main__.__file__) log_fname = "log_{}".format(exe_fname.split(".")[0]) if comment is not None and str(comment): log_fname = log_fname + "_" + str(comment) log_fname = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_logging(config: Any) -> Logger:\n green = \"\\033[32m\"\n reset = \"\\033[0m\"\n logger = setup_logger(\n name=f\"{green}[ignite]{reset}\",\n level=logging.DEBUG if config.debug else logging.INFO,\n format=\"%(name)s: %(message)s\",\n filepath=config.output_dir / \"tr...
[ "0.70399964", "0.6622312", "0.65885615", "0.65304697", "0.65240383", "0.6519144", "0.6495567", "0.6466729", "0.64612895", "0.6407961", "0.63969386", "0.63589936", "0.6348098", "0.6338948", "0.63224775", "0.6312327", "0.6312132", "0.63118017", "0.6299318", "0.6270785", "0.6250...
0.64892864
7
Load data using PyTorch DataLoader.
def load_data(config, vocab, proportion: float=0.7, max_len: int=256, partition: dict=None, labels: dict=None): # columns if meta: [0] unique ID, [1] text, [2] metadata, [3] label # columns if no meta: [0] unique ID, [1] text, [2] label if config["metadata"]: unique_id_col = 0 text_col = 1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_loader(data, train=True):\n\n loader_config = {\n 'batch_size':64,\n 'shuffle':train\n }\n \n return torch.utils.data.DataLoader(data, **loader_config)", "def train_dataloader(self) -> torch.utils.data.DataLoader: \n return torch.utils.data.DataLoader(self.datase...
[ "0.7888709", "0.785579", "0.7751118", "0.7633787", "0.7525572", "0.7270675", "0.7166334", "0.7075442", "0.70753306", "0.70659876", "0.69723433", "0.6967991", "0.69530183", "0.6943673", "0.6889306", "0.68799275", "0.6872247", "0.68637246", "0.6859212", "0.6836871", "0.68136996...
0.0
-1
Padding function for 1D sequences
def __pad__(sequence, max_l): if max_l - len(sequence) < 0: sequence = sequence[:max_l] else: sequence = np.pad(sequence, (0, max_l - (len(sequence))), 'constant', constant_values=(0)) return sequence
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad(seq, n):\n return", "def pad_sequence(xs, length=None, padding=0):\n return PadSequence(length, padding).apply((xs))[0]", "def pad_sequence(seq):\n seq_split = seq.strip().split(\"1\")\n last = seq_split[0]\n new_seq = last + \"1\"\n inc_added = 0\n out_added = 0\n for i in rang...
[ "0.77374345", "0.76362944", "0.737829", "0.7223377", "0.7206336", "0.7144797", "0.710272", "0.70930755", "0.70851046", "0.705326", "0.7034367", "0.700346", "0.6976378", "0.6973453", "0.69480914", "0.6854283", "0.68475085", "0.6833989", "0.6814044", "0.6806954", "0.67819375", ...
0.6773792
22
Embed words in a sequence using GLoVE model
def __glove_embed__(sequence, model): embedded = [] for word in sequence: embedded.append(model[word]) return embedded
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def embed(self, sequence):\n words = sequence.split(' ')\n vecs = [self._E[self._w2i[i]] if i in self._w2i else self._E[self._w2i[\"UNK\"]]\n for i in words]\n return vecs", "def embed(self, loader, model):\n print(\" ** Embedding words\")\n\n words = loader.w...
[ "0.6890587", "0.6337464", "0.6256114", "0.6213781", "0.61906195", "0.6124841", "0.6122943", "0.5976476", "0.5967347", "0.59281605", "0.5920156", "0.59157413", "0.591105", "0.5867188", "0.58647937", "0.5861155", "0.58420885", "0.58300006", "0.58148724", "0.5812145", "0.5800837...
0.80186236
0
Load embeddings either from cache or from scratch
def load_embeddings(config, name, vocab, training_generator, validation_generator): # Pickle embeddings should be AGNOSTIC to the name. This is because each pickled embedding is specific to the dataset and transformer. # Applies down the road when/if we attempt active learning data_name = config['train_fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_embeddings(cache_path):\n with open(cache_path, \"rb\") as fp:\n _cached_embs = pickle.load(fp)\n return _cached_embs", "def load_embeddings():\n return embedding_utils.PretrainedWordEmbeddings(\n lowercase=FLAGS.lowercase,\n embeddings_path=FLAGS.fasttext_embeddings...
[ "0.7840676", "0.7315518", "0.72570604", "0.7248901", "0.72128534", "0.71236014", "0.7081537", "0.70751274", "0.7022085", "0.6956653", "0.673481", "0.6694797", "0.6664453", "0.6633258", "0.65949357", "0.64013827", "0.63974303", "0.6372857", "0.63583666", "0.6338655", "0.632997...
0.71723187
5
Get BERT embeddings from a dataloader generator.
def _get_bert_embeddings(data_generator, embedding_model: torch.nn.Module, metadata: False): use_cuda = torch.cuda.is_available() device = torch.device("cuda:0" if use_cuda else "cpu") with torch.set_grad_enabled(False): embeddings = {'ids': [], 'embeddings': [], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_embeddings(model, loader, device=torch.device('cpu')):\n embeddings = []\n labels = []\n for item in loader:\n data, label = item\n data = data.view(-1, 1, data.shape[-1])\n data = data.to(device)\n label = label.to(device)\n output = model(data).squeeze(1)\n\n ...
[ "0.6092691", "0.60436624", "0.60151154", "0.59234816", "0.59059787", "0.5782936", "0.5690828", "0.5666181", "0.5597089", "0.5583591", "0.5570702", "0.55484855", "0.55165946", "0.5495378", "0.5463972", "0.5451432", "0.54469055", "0.54453945", "0.5405851", "0.54010916", "0.5367...
0.73473763
0
Reduced embeddings using PCA.
def get_pca_embeddings(config, name, training_embedding: dict, validation_embedding: dict): data_name = config['train_file'].split('/')[-1][:-4] # retrieve file name without the extension train_pca_pkl_f = os.path.join(config['pca_cache'], data_name + '_' + config['embedding_type'] + '_training_embeddings.p')...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pca(embedding, num_components=3, principal_components=None):\n# shape = embedding.get_shape().as_list()\n shape = tf.shape(embedding)\n embedding = tf.reshape(embedding, [-1, shape[3]])\n\n if principal_components is None:\n principal_components = calculate_principal_components(embedding,\n ...
[ "0.6760861", "0.6653581", "0.662987", "0.65325135", "0.6529479", "0.6509681", "0.65022707", "0.6487274", "0.64560676", "0.64380586", "0.6406564", "0.63860345", "0.63095546", "0.62621355", "0.6250614", "0.62483966", "0.62223923", "0.6219198", "0.6173256", "0.6162128", "0.60764...
0.66272324
3
Provides various metrics between predictions and labels.
def metrics(metric_type: str, preds: list, labels: list): assert metric_type in ['flat_accuracy', 'f1', 'roc_auc', 'ap'], 'Metrics must be one of the following: \ [\'flat_accuracy\', \'f1\', \'roc_auc\'] \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_metrics(pred, labels):\n pred_flat = np.argmax(pred, axis = 1).flatten()\n labels_flat = labels.flatten()\n \n flat_accuracy = np.sum(pred_flat == labels_flat) / len(labels_flat)\n \n # sklearn takes first parameter as the true label\n precision = precision_score(labels_flat, pred_flat)\n...
[ "0.7634908", "0.7342889", "0.72701824", "0.71024024", "0.70171285", "0.70013344", "0.698941", "0.6960283", "0.6859667", "0.6853133", "0.68380344", "0.6824996", "0.6816467", "0.6797667", "0.67882746", "0.6784857", "0.67818296", "0.6759894", "0.6757059", "0.6757059", "0.6755217...
0.6285268
96
True if parameter is active, i.e. its value differs from default.
def __bool__(self): # Do explicit cast to bool, as value can be a NumPy type, resulting in # an np.bool_ type for the expression (not allowed for __bool__) return bool(self.value != self.default_value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isActiveFitParam(param):\n return isFitParam(param) and param.isActive()", "def getBoolParam(self, params, name):\n return params.get(name) in ('True', 'true', '1')", "def active(self) -> pulumi.Input[bool]:\n return pulumi.get(self, \"active\")", "def check_active(value):\r\n\tif value ...
[ "0.72914785", "0.7089384", "0.6749947", "0.6713717", "0.6666445", "0.6666445", "0.6666445", "0.6666445", "0.66639507", "0.66464436", "0.6492625", "0.6490066", "0.64801526", "0.6458125", "0.64275116", "0.6371264", "0.63690764", "0.6319099", "0.63014305", "0.629577", "0.6269076...
0.0
-1
String form of parameter value used to convert it to/from a string.
def value_str(self): return self._to_str(self.value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_string(self, name, value):\r\n \r\n return str(value)", "def string(self, value):\n # respect {None}\n if value is None:\n # by leaving it alone\n return None\n # my value knows\n return str(value)", "def get_parameter_string(self, paramete...
[ "0.7203786", "0.697954", "0.69234365", "0.68567574", "0.6801373", "0.67694676", "0.6758182", "0.6719559", "0.66809326", "0.6662741", "0.6623675", "0.65918845", "0.6585053", "0.65313864", "0.6505384", "0.64526814", "0.64182854", "0.635534", "0.6343342", "0.62921274", "0.629084...
0.63790995
17
Short humanfriendly string representation of parameter object.
def __repr__(self): return "<katpoint.Parameter %s = %s %s at 0x%x>" % \ (self.name, self.value_str, self.units, id(self))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n\n return \"<ExoParameter>: {0}\".format(self.__dict__)", "def __str__(self):\n return self.parameters.__str__()", "def __str__(self):\r\n res = [self.Name + ' parameters:']\r\n for t in self._tracked_properties:\r\n res.append(t + ':' + str(getattr(se...
[ "0.74058735", "0.7150738", "0.70581096", "0.69755995", "0.6968546", "0.6926491", "0.6794039", "0.67680633", "0.6709835", "0.67044413", "0.66996485", "0.6644361", "0.65927416", "0.6591025", "0.65706384", "0.65648234", "0.65029067", "0.64802146", "0.64295065", "0.6425345", "0.6...
0.6784789
7
Number of parameters in full model.
def __len__(self): return len(self.params)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_params(self):", "def count_params(self):\n self.N = 0\n for name, param in self.model.named_parameters():\n self.N += param.numel()\n self.N_list.append(self.N)", "def num_parameters(self) -> int:\n if self._model:\n return self._model.num_parameters()\...
[ "0.8517904", "0.83146226", "0.8285639", "0.8231243", "0.8113813", "0.8113813", "0.8113813", "0.8045275", "0.80263823", "0.8018176", "0.8015244", "0.8014556", "0.7949592", "0.7944686", "0.79414004", "0.79262877", "0.7919125", "0.7889194", "0.78718674", "0.7828952", "0.7804306"...
0.7406236
46
True if model contains any active (nondefault) parameters.
def __bool__(self): return any(p for p in self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_active(self) -> bool:\n return any(x is not None for x in self._constraints)", "def params_required(self) -> bool:\n if self.no_params or self.params_optional:\n return False\n else:\n return True", "def no_params(self) -> bool:\n result = True\n ...
[ "0.67918104", "0.67808914", "0.6769819", "0.676107", "0.6671744", "0.6616392", "0.6594647", "0.6546123", "0.65182585", "0.6490626", "0.64229697", "0.63208073", "0.62987643", "0.62911", "0.6290869", "0.6289151", "0.62316024", "0.6204833", "0.616754", "0.61671543", "0.61343193"...
0.0
-1
Iterate over parameter objects.
def __iter__(self): return self.params.values().__iter__()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_params(self):\n for var, val in self._params.iteritems():\n yield var, val", "def parameters(self):\n for parameters in self:\n for parameter in parameters:\n yield parameter", "def get_params_iter(self):\n return []", "def __iter__(self):\n ...
[ "0.82385904", "0.7981038", "0.71825755", "0.7117291", "0.7055745", "0.69547874", "0.6832161", "0.67801243", "0.67296636", "0.66869706", "0.6610378", "0.6579612", "0.64453834", "0.6407792", "0.6394474", "0.6297057", "0.62369", "0.6233893", "0.6227109", "0.6217013", "0.62052274...
0.7283732
2
Justified (name, value, units, doc) strings for active parameters.
def param_strs(self): name_len = max(len(p.name) for p in self) value_len = max(len(p.value_str) for p in self.params.values()) units_len = max(len(p.units) for p in self.params.values()) return [(p.name.ljust(name_len), p.value_str.ljust(value_len), p.units.ljust(units_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n num_active = len([p for p in self if p])\n summary = \"%s has %d parameters with %d active (non-default)\" % \\\n (self.__class__.__name__, len(self), num_active)\n if num_active == 0:\n return summary\n return summary + ':\\n' + '\\n'.jo...
[ "0.7582478", "0.6667753", "0.65951604", "0.6493384", "0.64455795", "0.64114326", "0.63715106", "0.62896985", "0.6242153", "0.62383384", "0.62208116", "0.62207097", "0.61746264", "0.6109571", "0.61072844", "0.6098375", "0.60816747", "0.6051815", "0.6050969", "0.60330296", "0.6...
0.7280672
1
Short humanfriendly string representation of model object.
def __repr__(self): num_active = len([p for p in self if p]) return "<katpoint.%s active_params=%d/%d at 0x%x>" % \ (self.__class__.__name__, num_active, len(self), id(self))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"", "def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"", "def __str__(self):\n return super().__str__() + self.model.__str__()",...
[ "0.8028083", "0.8028083", "0.79938656", "0.7976418", "0.7948468", "0.77171636", "0.7662623", "0.76042145", "0.7593325", "0.7579472", "0.7536077", "0.7449067", "0.74469894", "0.74191", "0.7378081", "0.7339475", "0.73324215", "0.7328719", "0.7328719", "0.730302", "0.72758746", ...
0.0
-1
Verbose humanfriendly string representation of model object.
def __str__(self): num_active = len([p for p in self if p]) summary = "%s has %d parameters with %d active (non-default)" % \ (self.__class__.__name__, len(self), num_active) if num_active == 0: return summary return summary + ':\n' + '\n'.join(('%s = %s %s ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self):\n model = self._meta.verbose_name.title()\n title = self.extended_object.get_title()\n return f\"{model:s}: {title:s}\"", "def __str__(self):\n model = self._meta.verbose_name.title()\n...
[ "0.78885835", "0.7783697", "0.77635914", "0.77635914", "0.7730236", "0.760641", "0.75836486", "0.7574152", "0.75515556", "0.7453203", "0.74457", "0.7392917", "0.7392917", "0.7386357", "0.73556995", "0.7335823", "0.731109", "0.725926", "0.72402775", "0.720554", "0.71744984", ...
0.0
-1
Equality comparison operator (parameter values only).
def __eq__(self, other): return self.description == \ (other.description if isinstance(other, self.__class__) else other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def values_eq(self, a, b):\r\n return a == b", "def testEquality(self):\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*arg...
[ "0.7495514", "0.7350638", "0.71365744", "0.71365744", "0.71365744", "0.71365744", "0.71365744", "0.71365744", "0.71365744", "0.71365744", "0.71365744", "0.71365744", "0.71365744", "0.71365744", "0.71365744", "0.71365744", "0.71365744", "0.71365744", "0.71365744", "0.71365744", ...
0.0
-1
Inequality comparison operator (parameter values only).
def __ne__(self, other): return not (self == other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, values):\n self = self.__eq__(values)\n return self.__invert__()", "def __ne__(self, rhs):\n return not self.__eq__(rhs)", "def not_equal(lhs, rhs):\n return _make.not_equal(lhs, rhs)", "def __neq__(self, other): \n return not self == other", "def test...
[ "0.72408104", "0.71416056", "0.69568586", "0.6941666", "0.68447745", "0.6843122", "0.6838853", "0.68197155", "0.6807232", "0.679406", "0.6777357", "0.673857", "0.673857", "0.673857", "0.673857", "0.6725665", "0.6725112", "0.6718812", "0.67053616", "0.6701271", "0.66915655", ...
0.0
-1
Base hash on description string, just like equality operator.
def __hash__(self): return hash(self.description)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash(self) -> str:\r\n ...", "def __hash__(self):\n\n return hash((str(self.type) + str(self.value)))", "def __hash__(self):\n return hash(self.text)", "def hash(self) -> bytes:", "def hash(self, string):\n return self.__scaffydb.hash(string)", "def __hash__(self):\n ...
[ "0.72970223", "0.70238286", "0.6990711", "0.68921405", "0.6877547", "0.6868672", "0.6868672", "0.6868672", "0.6853107", "0.6853107", "0.6853107", "0.6853107", "0.6820892", "0.68152857", "0.67963797", "0.67854613", "0.67854613", "0.67854613", "0.6765069", "0.67579234", "0.6742...
0.8038765
0
Access parameter value by name.
def __getitem__(self, key): return self.params[key].value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getParam(self, params, name):\n return params.get(name)", "def getParameter(self, name):", "def GetValueByName(self, name):", "def get_param_with_name(self, param_name):\n return self.params[param_name]", "def get_parameter(self, name: str) -> any:\r\n if name in self.kwargs:\r\n ...
[ "0.81560856", "0.8143507", "0.7823986", "0.7630813", "0.7557198", "0.7383771", "0.7367008", "0.7312119", "0.7287928", "0.7264385", "0.7236408", "0.7168084", "0.7144382", "0.7120741", "0.70506805", "0.7047843", "0.7025448", "0.70219696", "0.70115006", "0.69442713", "0.6915904"...
0.6977442
19
Modify parameter value by name.
def __setitem__(self, key, value): self.params[key].value = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setParameter(self, name, value):", "def set(self,name,val):\n matches = self.grep_param_names(name)\n if len(matches):\n x = self._get_params()\n x[matches] = val\n self._set_params(x)\n else:\n raise AttributeError, \"no parameter matches %s\"...
[ "0.80584186", "0.7877263", "0.7659529", "0.7543547", "0.747998", "0.737759", "0.7360991", "0.7008698", "0.6985977", "0.69003344", "0.6785371", "0.6783321", "0.6777866", "0.6752631", "0.6717762", "0.6686711", "0.66651803", "0.6661193", "0.66512424", "0.66512424", "0.66446614",...
0.6204177
46
List of parameter names in the expected order.
def keys(self): return self.params.keys()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parameter_names(self) -> List[str]:", "def parameterNames(self, p_int): # real signature unknown; restored from __doc__\n return []", "def get_param_names(self):\n return list(self.params.keys())", "def parameter_names(self) -> list:\n parameters = []\n parameters.extend(self....
[ "0.8899528", "0.8256276", "0.8223466", "0.81843793", "0.81773764", "0.76406306", "0.7631603", "0.75550413", "0.75500125", "0.74934304", "0.74912333", "0.74750197", "0.7323525", "0.7297529", "0.7277972", "0.7231873", "0.71911895", "0.71234643", "0.7113123", "0.71071076", "0.70...
0.64429533
62
List of parameter values in the expected order ('tolist').
def values(self): return [p.value for p in self]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parameters_list(self):\n return [getattr(self.parameters, p) for p in self.parameters_names()]", "def parameter_values(self) -> List[Tuple[str, Any]]:\n pvs = [(param, getattr(self, variable))\n for variable, param in self.variable_name_to_query_param.items()]\n return [(p,...
[ "0.73683417", "0.7149095", "0.7077", "0.7076585", "0.7047869", "0.7043692", "0.7038208", "0.70156145", "0.7003395", "0.6993167", "0.6993167", "0.6947928", "0.69282645", "0.68996793", "0.68764114", "0.6848381", "0.6839425", "0.6823277", "0.6816432", "0.68062204", "0.6788033", ...
0.6143704
58
Load model from sequence of floats.
def fromlist(self, floats): self.header = {} params = [p for p in self] min_len = min(len(params), len(floats)) for param, value in zip(params[:min_len], floats[:min_len]): param.value = value for param in params[min_len:]: param.value = param.default_valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load(self):\n for k,v in self.parameters.items():\n if isinstance(v,list):\n setattr(self,k,np.array(v,dtype=np.float32))\n else:\n setattr(self,k,v)", "def parse_model(f_name):\n if os.path.isfile(f_name):\n with open(f_name) as f:\n ...
[ "0.59494925", "0.5694197", "0.56045514", "0.5498191", "0.5488356", "0.5477136", "0.5466593", "0.54611206", "0.54511726", "0.54432213", "0.54343504", "0.5339388", "0.5335935", "0.5305303", "0.52712786", "0.5249649", "0.5237072", "0.5233914", "0.52248335", "0.5221053", "0.52194...
0.5443327
9
Compact but complete string representation ('tostring').
def description(self): active = np.nonzero([bool(p) for p in self])[0] last_active = active[-1] if len(active) else -1 return ' '.join([p.value_str for p in self][:last_active + 1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_str(self) -> str:", "def toString():", "def safeToString():", "def __str__(self):\n\n if not self:\n return '\\0'\n\n parts = []\n for name, value in self:\n if value is None:\n item = name\n else:\n item = '%s=%s' % (...
[ "0.755594", "0.74858665", "0.73231876", "0.72323847", "0.72257227", "0.7008717", "0.69522905", "0.69489115", "0.69489115", "0.6871342", "0.68474585", "0.68474585", "0.6772113", "0.6723712", "0.66784674", "0.6602459", "0.6586125", "0.658413", "0.65728617", "0.6562585", "0.6560...
0.0
-1
Load model from description string (parameters only).
def fromstring(self, description): self.header = {} # Split string either on commas or whitespace, for good measure param_vals = [p.strip() for p in description.split(',')] \ if ',' in description else description.split() params = [p for p in self] min_len = min(len(p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_model(self, model_path: str):", "def load_model(self, filename):\r\n pass", "def load(path_to_model):\n pass", "def load_model(self, path):\n pass", "def load_model(self) -> Any:", "def load_model(language_id, model_type):\n\n # getting the language code from it's id\n lan...
[ "0.694506", "0.6934816", "0.67814714", "0.6613543", "0.6562278", "0.64866006", "0.64678144", "0.6464032", "0.6308483", "0.61974365", "0.61927617", "0.61660534", "0.61602557", "0.61448705", "0.6130916", "0.61297876", "0.6126128", "0.61022365", "0.6065545", "0.6058375", "0.6046...
0.5545173
94
Save model to config file (both header and parameters).
def tofile(self, file_like): cfg = configparser.SafeConfigParser() cfg.add_section('header') for key, val in self.header.items(): cfg.set('header', key, str(val)) cfg.add_section('params') for param_str in self.param_strs(): cfg.set('params', param_str[0],...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_config(self, save_path: str) -> None:\n os.makedirs(save_path, exist_ok=True)\n model_hyperparameters_path = os.path.join(save_path, MODEL_HYPERPARAMETERS_FILE_NAME)\n save_json(model_hyperparameters_path, self.config_obj.to_dict())", "def save(self):\n file = open(self.path,...
[ "0.763178", "0.74892414", "0.74538445", "0.74108565", "0.7388762", "0.73329777", "0.72090554", "0.7158334", "0.7151382", "0.7149014", "0.71323335", "0.71320057", "0.7099478", "0.7097612", "0.7079394", "0.7034409", "0.6995227", "0.69945264", "0.6982993", "0.69599545", "0.69179...
0.0
-1
Load model from config file (both header and parameters).
def fromfile(self, file_like): defaults = dict((p.name, p._to_str(p.default_value)) for p in self) if future.utils.PY2: cfg = configparser.SafeConfigParser(defaults) else: cfg = configparser.ConfigParser(defaults, inline_comment_prefixes=(';', '#')) try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def load_model(\n self,\n model_name: str,\n headers: dict[str, t.Any] = ...,\n config: str = ...,\n files: dict[str, str] = ...,\n ) -> None:", "def load_config(filename):\n with open(filename, \"r\") as my_file:\n my_file = my_file.read()\n return K....
[ "0.7542821", "0.7373315", "0.73305744", "0.7220506", "0.71582717", "0.71088517", "0.695264", "0.686733", "0.680585", "0.67566395", "0.6753529", "0.67380685", "0.67345", "0.6729725", "0.6692068", "0.6689554", "0.66882926", "0.668114", "0.6674514", "0.66543514", "0.65970093", ...
0.62608147
56
Load parameter values from the appropriate source.
def set(self, model=None): if isinstance(model, Model): if not isinstance(model, type(self)): raise BadModelFile('Cannot construct a %r from a %r' % (self.__class__.__name__, model.__class__.__name__)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_parameter(self):", "def _load(self, load_dict):\n if self.v_locked:\n raise pex.ParameterLockedException(\n \"Parameter `%s` is locked!\" % self.v_full_name\n )\n\n if \"data\" in load_dict:\n self._data = load_dict[\"data\"][\"data\"][0]\n ...
[ "0.740036", "0.64931524", "0.6455669", "0.6353233", "0.6309897", "0.63086814", "0.6287176", "0.62651426", "0.6150741", "0.6106724", "0.60551184", "0.6034574", "0.6032307", "0.6026318", "0.59740245", "0.59592307", "0.5957556", "0.5954891", "0.5941733", "0.59211797", "0.5912147...
0.0
-1
Convert 2D alignment parameters (alpha, sx, sy, mirror) into 3D alignment parameters (phi, theta, psi, s2x, s2y, mirror)
def params_2D_3D(alpha, sx, sy, mirror): phi = 0 psi = 0 theta = 0 alphan, s2x, s2y, scalen = compose_transform2(0, sx, sy, 1, -alpha, 0, 0, 1) if mirror > 0: phi = (540.0 + phi)%360.0 theta = 180.0 - theta psi = (540.0 - psi + alphan)%360.0 else: psi = (psi + alphan)%360.0 return phi, theta, ps...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def params_3D_2D(phi, theta, psi, s2x, s2y):\n\tif theta > 90.0:\n\t\tmirror = 1\n\t\talpha, sx, sy, scalen = compose_transform2(0, s2x, s2y, 1.0, 540.0-psi, 0, 0, 1.0)\n\telse:\n\t\tmirror = 0\n\t\talpha, sx, sy, scalen = compose_transform2(0, s2x, s2y, 1.0, 360.0-psi, 0, 0, 1.0)\n\treturn alpha, sx, sy, mirror"...
[ "0.75017375", "0.6478277", "0.647607", "0.63587636", "0.60074914", "0.5803451", "0.5758167", "0.5752519", "0.5700443", "0.5646637", "0.56198543", "0.5572641", "0.5455936", "0.54369533", "0.5418458", "0.5403827", "0.539565", "0.5376442", "0.53718555", "0.53706646", "0.53607404...
0.78717786
0
Convert 3D alignment parameters (phi, theta, psi, s2x, s2y) there is no mirror in 3D! into 2D alignment parameters (alpha, sx, sy, mirror)
def params_3D_2D(phi, theta, psi, s2x, s2y): if theta > 90.0: mirror = 1 alpha, sx, sy, scalen = compose_transform2(0, s2x, s2y, 1.0, 540.0-psi, 0, 0, 1.0) else: mirror = 0 alpha, sx, sy, scalen = compose_transform2(0, s2x, s2y, 1.0, 360.0-psi, 0, 0, 1.0) return alpha, sx, sy, mirror
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def params_2D_3D(alpha, sx, sy, mirror):\n\tphi = 0\n\tpsi = 0\n\ttheta = 0\n\talphan, s2x, s2y, scalen = compose_transform2(0, sx, sy, 1, -alpha, 0, 0, 1)\n\tif mirror > 0:\n\t\tphi = (540.0 + phi)%360.0\n\t\ttheta = 180.0 - theta\n\t\tpsi = (540.0 - psi + alphan)%360.0\n\telse:\n\t\tpsi = (psi + alphan)...
[ "0.76915425", "0.6404001", "0.6382034", "0.6108902", "0.6060465", "0.6017704", "0.57541436", "0.5705645", "0.5625745", "0.5595656", "0.5591025", "0.55300176", "0.5473145", "0.53983897", "0.53954655", "0.5385849", "0.53646827", "0.53643596", "0.536235", "0.5350919", "0.5346317...
0.7371874
1
Commented by Zhengfan Yang on 05/01/07 I made some change to the original amoeba so that it can now pass out some values calculated by func other than the criteria. This is important in multilevel amoeba refinement because otherwise, upper level refinement will lose the information of lower level refinement.
def amoeba_multi_level(var, scale, func, ftolerance=1.e-4, xtolerance=1.e-4, itmax=500, data=None): #print " ENTER AMOEBA MULTI LEVEL" nvar = len(var) # number of variables in the minimization nsimplex = nvar + 1 # number of vertices in the simplex # first set up the simplex simplex = [0]*(nvar+1) # set...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fit_amoeba(self, kwargs, verbose):\n\n args_init = self._param_class.kwargs_to_args(kwargs)\n\n options = {\n \"adaptive\": True,\n \"fatol\": self._tol_simplex_func,\n \"maxiter\": self._simplex_n_iterations * len(args_init),\n }\n\n method = \"Nel...
[ "0.5649461", "0.56487626", "0.5537902", "0.55107564", "0.5501089", "0.54266936", "0.5403812", "0.53776634", "0.5360801", "0.5356619", "0.5301135", "0.52775687", "0.5269604", "0.5262089", "0.52313644", "0.5223302", "0.5188832", "0.5179477", "0.516795", "0.51599634", "0.5152701...
0.599668
0
Given a function of onevariable and a possible bracketing interval, return the minimum of the function isolated to a fractional precision of tol. A bracketing interval is a triple (a,b,c) where (a<b<c) and func(b) < func(a),func(c). If bracket is two numbers then they are assumed to be a starting interval for a downhil...
def golden(func, args=(), brack=None, tol=1.e-4, full_output=0): if brack is None: xa,xb,xc,fa,fb,fc,funcalls = bracket(func, args=args) elif len(brack) == 2: xa,xb,xc,fa,fb,fc,funcalls = bracket(func, xa=brack[0], xb=brack[1], args=args) elif len(brack) == 3: xa,xb,xc = brack if (xa > xc): # swap so xa < x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bisect(f, x1, x2, tol=1.0e-9):\n assert callable(f), \"User-supplied function must be callable.\"\n assert x1 != x2, \"Bad initial range given to bracket.\"\n f1 = f(x1)\n f2 = f(x2)\n assert f1 * f2 < 0.0, \"Range does not clearly bracket a root.\"\n while abs(x2 - x1) > tol:\n x_mid ...
[ "0.6708032", "0.65304935", "0.62501", "0.5912542", "0.58930385", "0.58231115", "0.5812576", "0.5808945", "0.57922816", "0.5788117", "0.5785699", "0.57082534", "0.56653464", "0.5637875", "0.5637021", "0.5635716", "0.5600486", "0.55882996", "0.55636096", "0.5525852", "0.5503440...
0.5996638
3
Given a function and distinct initial points, search in the downhill direction (as defined by the initital points) and return new points
def bracket(func, xa=0.0, xb=1.0, args=(), grow_limit=110.0, maxiter=1000): _gold = 1.618034 _verysmall_num = 1e-21 fa = apply(func, (xa,)+args) fb = apply(func, (xb,)+args) if (fa < fb): # Switch so fa > fb dum = xa; xa = xb; xb = dum dum = fa; fa = fb; fb = dum xc = xb + _gold*(xb-xa) fc = apply...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convergent_point(x0, x1, f):\n while x0 != x1:\n x0, x1 = f(x0), f(x1)\n return x0", "def downhill(F, xStart, args=None, side=0.1, ftol=1.0e-6, xtol=1.0e-6, maxiter=1000, maxfunc=1000, maxiternochange=10):\n # TODO: check the types of the input ???\n\n # print \"Entering downhill\"...
[ "0.6356492", "0.6195878", "0.5991574", "0.58792716", "0.584689", "0.58225703", "0.5817831", "0.5659458", "0.5653146", "0.56466967", "0.56169575", "0.56137437", "0.5609491", "0.55890185", "0.5563145", "0.55528545", "0.55420315", "0.55300105", "0.552903", "0.55165887", "0.54849...
0.0
-1
Fit the histogram of the input image under mask with the reference image.
def ce_fit(inp_image, ref_image, mask_image): hist_res = Util.histc(ref_image, inp_image, mask_image) args = hist_res["args"] scale = hist_res["scale"] data = [hist_res['data'], inp_image, hist_res["ref_freq_bin"], mask_image, int(hist_res['size_img']), hist_res['hist_len']] res = amoeba(args, scale, hist_func, 1....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hist2d(x,y,nbins = 50 ,maskval = 0,saveloc = '',labels=[],slope = 1,sloperr = 0):\n\t# Remove NANs and masked values\n\tgood = where((isnan(x) == False) & (isnan(y) == False) & (x != maskval) & (y != maskval))\n\tx = x[good]\n\ty = y[good]\n\n\t# Create histogram\n\tH,xedges,yedges = histogram2d(x,y,bins=nbins...
[ "0.5717073", "0.55807126", "0.5528441", "0.55023885", "0.54681766", "0.54579365", "0.54448426", "0.54230475", "0.54140556", "0.5352749", "0.53307045", "0.5266392", "0.52623886", "0.5244729", "0.52365315", "0.52273583", "0.52006847", "0.52000165", "0.5193751", "0.5170942", "0....
0.57911646
0
Find the position of the commone line in 3D Formula is (RB^T zhat) cross (RA^T zhat) Returns phi, theta of the common line in degrees. theta always < 90 Notice you don't need to enter psi's; they are irrelevant
def common_line_in3D(phiA,thetaA,phiB,thetaB): from math import pi, sqrt, cos, sin, asin, atan2 piOver=pi/180.0; ph1 = phiA*piOver; th1 = thetaA*piOver; ph2 = phiB*piOver; th2 = thetaB*piOver; #nx = cos(thetaBR)*sin(thetaAR)*sin(phiAR) - cos(thetaAR)*sin(thetaBR)*sin(phiBR) ; #ny = cos(thetaAR)*sin(thet...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def theta_finder(theta, point_a, point_b, point_c, point_c_new):\n x, y, z = parametrized_circle(point_a, point_b, point_c, theta)\n residual = (x - point_c_new[0])**2 + (y - point_c_new[1])**2 + (z - point_c_new[2])**2\n return residual", "def cart2spheric(x, y, z):\n # doesn't compute r because cho...
[ "0.6163923", "0.6056872", "0.6046275", "0.60347825", "0.59408677", "0.5916736", "0.58936423", "0.5829221", "0.58063835", "0.57062423", "0.57015944", "0.56956786", "0.5686689", "0.56826967", "0.56771237", "0.5673097", "0.56674886", "0.56646484", "0.56586415", "0.56585634", "0....
0.68433595
0
Print the composition of two transformations T2T1
def compose_transform2(alpha1, sx1, sy1, scale1, alpha2, sx2, sy2, scale2): t1 = Transform({"type":"2D","alpha":alpha1,"tx":sx1,"ty":sy1,"mirror":0,"scale":scale1}) t2 = Transform({"type":"2D","alpha":alpha2,"tx":sx2,"ty":sy2,"mirror":0,"scale":scale2}) tt = t2*t1 d = tt.get_params("2D") return d[ "alpha" ], d[ "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _print_transforms(self):\n self._print_frozen_transforms()\n self._print_nonfrozen_transforms()", "def print_output_task2(model1,model2):\n print(\"######################################################################\")\n print(\"Task 2 : IBM model 1 and 2 Analysis(using NLTK)\")\n print(\"#...
[ "0.6846836", "0.593155", "0.58877105", "0.5660713", "0.5565579", "0.5429697", "0.5382136", "0.5374937", "0.5349274", "0.5291017", "0.5267222", "0.5266499", "0.52166545", "0.5211318", "0.5192603", "0.51735705", "0.5163085", "0.5161964", "0.51475674", "0.5144708", "0.513714", ...
0.54261017
6
Compute the composition of two transformations T2T1
def compose_transform3(phi1,theta1,psi1,sx1,sy1,sz1,scale1,phi2,theta2,psi2,sx2,sy2,sz2,scale2): R1 = Transform({"type":"spider","phi":float(phi1),"theta":float(theta1),"psi":float(psi1),"tx":float(sx1),"ty":float(sy1),"tz":float(sz1),"mirror":0,"scale":float(scale1)}) R2 = Transform({"type":"spider","phi":float(phi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compose_transform(T1, T2):\n aux_vec = np.array([0, 0, 1]).reshape(1, 3)\n\n T1 = np.concatenate((T1, aux_vec), axis=0)\n T2 = np.concatenate((T2, aux_vec), axis=0)\n\n T1_inv = np.linalg.inv(T1)\n T = T1_inv@T2\n\n return T[0:2]", "def compose_transform2(alpha1, sx1, sy1, scale1, alpha2, s...
[ "0.7939624", "0.6803194", "0.6570444", "0.632991", "0.63013947", "0.62177503", "0.61400926", "0.6106614", "0.61058927", "0.6075287", "0.5950678", "0.59419036", "0.5940465", "0.5888778", "0.585534", "0.58440787", "0.5840003", "0.5824449", "0.578852", "0.5774012", "0.57467675",...
0.5716005
21
Combine 2D alignent parameters including mirror
def combine_params2(alpha1, sx1, sy1, mirror1, alpha2, sx2, sy2, mirror2): t1 = Transform({"type":"2D","alpha":alpha1,"tx":sx1,"ty":sy1,"mirror":mirror1,"scale":1.0}) t2 = Transform({"type":"2D","alpha":alpha2,"tx":sx2,"ty":sy2,"mirror":mirror2,"scale":1.0}) tt = t2*t1 d = tt.get_params("2D") return d[ "alpha" ],...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_align_invert(self):\n al = align(self.amp1, self.amp2, inverse=False)\n\n al_inv = align(self.amp2, self.amp1, inverse=True)\n\n print(al.R)\n print(al_inv.R)\n\n print(al.T)\n print(al_inv.T)", "def coord_space(\n a0: numpy.ndarray, a1: numpy.ndarray, a2: nu...
[ "0.6219051", "0.6053582", "0.5752545", "0.57426506", "0.5725641", "0.5692372", "0.5691541", "0.5664221", "0.56270707", "0.5618279", "0.5603235", "0.5593693", "0.5545809", "0.545052", "0.5446854", "0.5441767", "0.54299045", "0.54238695", "0.54219955", "0.5421373", "0.5344707",...
0.6524807
0
Convert a text file that is composed of columns of numbers into spider doc file
def create_spider_doc(fname,spiderdoc): from string import atoi,atof infile = open(fname,"r") lines = infile.readlines() infile.close() nmc = len(lines[0].split()) table=[] for line in lines: data = line.split() for i in xrange(0,nmc): data[i] = atof(data[i]) table.append(data) drop_spider_doc(spiderdo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_docs(filename):\n \n # open word doc\n word = win32.gencache.EnsureDispatch('Word.Application')\n doc = word.Documents.Open(os.getcwd() + '/' + filename + \".doc\")\n doc.Activate()\n \n # read word doc as list of lists\n data = [doc.Tables(i).Range.Text for i in range(1,5)]\n...
[ "0.5493499", "0.54529065", "0.5267102", "0.52564555", "0.5165884", "0.5158104", "0.5139018", "0.5111768", "0.50976145", "0.5082693", "0.50638324", "0.50472414", "0.5038567", "0.5021236", "0.5013941", "0.5003135", "0.49983117", "0.49895382", "0.49807015", "0.49714673", "0.4959...
0.6535076
0
Write an image to the disk.
def drop_image(imagename, destination, itype="h"): if type(destination) == type(""): if(itype == "h"): imgtype = EMUtil.ImageType.IMAGE_HDF elif(itype == "s"): imgtype = EMUtil.ImageType.IMAGE_SINGLE_SPIDER else: ERROR("unknown image type","drop_image",1) imagename.write_image(destination, 0, imgtype) e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, image):\n raise NotImplementedError()", "def write(img, path):\n create_directories_for_file_name(path)\n writer = sitk.ImageFileWriter()\n writer.Execute(img, path, True)", "def write_image(self, image_name, image):\n raise NotImplementedError", "def write_image(self, ...
[ "0.8019482", "0.7901197", "0.7840147", "0.7802012", "0.7660659", "0.7581917", "0.75348264", "0.74246275", "0.7338141", "0.7248253", "0.7200103", "0.719786", "0.7190718", "0.718748", "0.7168532", "0.71044123", "0.70858777", "0.7034931", "0.6973645", "0.6935908", "0.6884878", ...
0.0
-1
Write an image with the proper png save
def drop_png_image(im, trg): if trg[-4:] != '.png': ERROR('destination name must be png extension', 'drop_png_image', 1) if isinstance(trg, basestring): im['render_min'] = im['minimum'] im['render_max'] = im['maximum'] im.write_image(trg, 0) else: ERROR('destination is not a file name', 'drop_png_image',...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_image(image, file_name):\n io.imsave(file_name,image)", "def test_save_png():\n img = Image.new('RGB', (10, 20))\n\n parameters = {'path': 'green-dot.png', 'data': [img]}\n\n assert images.save(parameters)", "def save_png(self, filename):\n post_script = self.canvas.postscript().enc...
[ "0.7533463", "0.7480259", "0.7462284", "0.74407417", "0.73850626", "0.7356224", "0.73480725", "0.72761285", "0.7220644", "0.721927", "0.7194732", "0.7168477", "0.7134913", "0.71134233", "0.7101273", "0.7100358", "0.7097144", "0.70930296", "0.70745164", "0.7069603", "0.7046678...
0.0
-1
Create a spidercompatible "Doc" file.
def drop_spider_doc(filename, data, comment = None): outf = open(filename, "w") from datetime import datetime outf.write(" ; %s %s %s\n" % (datetime.now().ctime(), filename, comment)) count = 1 # start key from 1; otherwise, it is confusing... for dat in data: try: nvals = len(dat) if nvals <= 5: da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeDocFile(self):\n\n f_out = \"%s/%s-doc.php\" % (self.dir_out, self.project_id)\n version = max(self.versions)\n\n with open(f_out, 'w') as f:\n f.write(\"<!DOCTYPE html>\\n\" \\\n \"<html xmlns=\\\"http://www.w3.org/1999/xhtml\\\">\\n\" \\\n ...
[ "0.7526909", "0.67890173", "0.65753114", "0.6515147", "0.65132904", "0.65004843", "0.6358768", "0.63038355", "0.6276474", "0.621243", "0.61798906", "0.616652", "0.6122261", "0.610907", "0.61049974", "0.6098085", "0.6066121", "0.60467553", "0.60288143", "0.60257435", "0.602205...
0.0
-1
Output the data in slice iz, row ix of an image to standard out.
def dump_row(input, fname, ix=0, iz=0): fout = open(fname, "w") image=get_image(input) nx = image.get_xsize() ny = image.get_ysize() nz = image.get_zsize() fout.write("# z = %d slice, x = %d row)\n" % (iz, ix)) line = [] for iy in xrange(ny): fout.write("%d\t%12.5g\n" % (iy, image.get_value_at(ix,iy,iz))) fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_image_row(input, iy=0, iz=0):\n\timage=get_image(input)\n\tnx = image.get_xsize()\n\tny = image.get_ysize()\n\tnz = image.get_zsize()\n\tprint \"(z = %d slice, y = %d col)\" % (iz, iy)\n\tline = []\n\tfor ix in xrange(nx):\n\t\tline.append(\"%12.5g \" % (image.get_value_at(ix,iy,iz)))\n\t\tif ((ix + 1) ...
[ "0.71635914", "0.70319664", "0.7031056", "0.6987682", "0.68559015", "0.6734682", "0.6646704", "0.64677995", "0.6236939", "0.60654515", "0.59142405", "0.56288266", "0.5549433", "0.5510461", "0.5490116", "0.5405265", "0.54043865", "0.5386131", "0.5378602", "0.53766", "0.5349916...
0.7089794
1
Create a list of Euler angles suitable for projections. method is either 'S' for Saff algorithm or 'P' for Penczek '94 algorithm 'S' assumes phi1> delta ; symmetry if this is set to pointgroup symmetry (cn or dn) or helical symmetry with pointgroup symmetry (scn or sdn), it will yield angles from the asymmetric unit, n...
def even_angles(delta = 15.0, theta1=0.0, theta2=90.0, phi1=0.0, phi2=359.99, method = 'S', phiEqpsi = "Minus", symmetry='c1'): from math import pi, sqrt, cos, acos, tan, sin from utilities import even_angles_cd from string import lower,split angles = [] symmetryLower = symmetry.lower() symmetry_string =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def even_angles_cd(delta, theta1=0.0, theta2=90.0, phi1=0.0, phi2=359.99, method = 'P', phiEQpsi='Minus'):\n\tfrom math import pi, sqrt, cos, acos\n\tangles = []\n\tif (method == 'P'):\n\t\ttemp = Util.even_angles(delta, theta1, theta2, phi1, phi2)\n\t\t#\t\t phi, theta...
[ "0.63690925", "0.59872353", "0.5834576", "0.5605631", "0.5481775", "0.5450778", "0.5426255", "0.5415383", "0.540476", "0.54044795", "0.53929913", "0.5386991", "0.5379755", "0.53729224", "0.5372181", "0.5360525", "0.53372157", "0.5305089", "0.53043467", "0.5274299", "0.5256057...
0.616338
1
Create a list of Euler angles suitable for projections. method is either 'S' for Saff algorithm or 'P' for Penczek '94 algorithm 'S' assumes phi1> delta ; phiEQpsi set this to 'Minus', if you want psi=phi;
def even_angles_cd(delta, theta1=0.0, theta2=90.0, phi1=0.0, phi2=359.99, method = 'P', phiEQpsi='Minus'): from math import pi, sqrt, cos, acos angles = [] if (method == 'P'): temp = Util.even_angles(delta, theta1, theta2, phi1, phi2) # phi, theta, psi for i in xr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def even_angles(delta = 15.0, theta1=0.0, theta2=90.0, phi1=0.0, phi2=359.99, method = 'S', phiEqpsi = \"Minus\", symmetry='c1'):\n\n\tfrom math import pi, sqrt, cos, acos, tan, sin\n\tfrom utilities import even_angles_cd\n\tfrom string import lower,split\n\tangles = []\n\tsymmetryLower = symmetry.lower()\...
[ "0.6162403", "0.60886765", "0.5816294", "0.5785667", "0.5628353", "0.5463198", "0.54578865", "0.5440061", "0.5435098", "0.5419207", "0.53673875", "0.53652376", "0.5361059", "0.5337354", "0.5325969", "0.53146446", "0.52769536", "0.52645385", "0.52579445", "0.52271026", "0.5220...
0.6891914
0
Perform PCA on stack file and Get eigen images
def eigen_images_get(stack, eigenstack, mask, num, avg): from utilities import get_image a = Analyzers.get('pca_large') e = EMData() if(avg == 1): s = EMData() nima = EMUtil.get_image_count(stack) for im in xrange(nima): e.read_image(stack,im) e *= mask a.insert_image(e) if( avg==1): if(im==0): s ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def images_pca(images_folder, limit=100, k=3):\n my_images = []\n shape = None\n files = os.listdir(images_folder)\n random.shuffle(files)\n files = files[:limit]\n for study_file in files:\n assert study_file.endswith('.pkl'), 'file %s has wrong extension' % study_file\n with open(...
[ "0.64291614", "0.62826765", "0.62180424", "0.6019128", "0.6007571", "0.60039264", "0.59644985", "0.59346586", "0.5876533", "0.57791483", "0.57538944", "0.5750904", "0.57483804", "0.57071185", "0.5668783", "0.56590796", "0.5637482", "0.5597626", "0.55744284", "0.5562899", "0.5...
0.5309758
40
Find the z rotation such that ZA RA is as close as possible to RB this maximizes trace of ( RB^T ZA RA) = trace(ZA RA RB^T)
def find_inplane_to_match(phiA,thetaA,phiB,thetaB,psiA=0,psiB=0): #from math import pi, sqrt, cos, acos, sin RA = Transform({'type': 'spider', 'phi': phiA, 'theta': thetaA, 'psi': psiA}) RB = Transform({'type': 'spider', 'phi': phiB, 'theta': thetaB, 'psi': psiB}) RBT = RB.transpose() RABT = RA * RBT RABTe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_optimal_angle(teta_z, latitude, transmissivity):\n if transmissivity <= 0.15:\n gKt = 0.977\n elif 0.15 < transmissivity <= 0.7:\n gKt = 1.237 - 1.361 * transmissivity\n else:\n gKt = 0.273\n Tad = 0.98 # transmittance-absorptance product of the diffuse radiation\n Tar...
[ "0.5970234", "0.586566", "0.5805997", "0.5770309", "0.57532215", "0.5680772", "0.566361", "0.5569986", "0.5537452", "0.5494817", "0.5490782", "0.5471373", "0.54355586", "0.54301345", "0.5428771", "0.54233015", "0.54138273", "0.5389946", "0.53683394", "0.53642684", "0.5326583"...
0.0
-1
smooth sharp_edge_image with Gaussian function 1. The sharpedge image is convoluted with a gassian kernel 2. The convolution normalized
def gauss_edge(sharp_edge_image, kernel_size = 7, gauss_standard_dev =3): from utilities import model_gauss from EMAN2 import rsconvolution nz = sharp_edge_image.get_ndim() if(nz == 3): kern = model_gauss(gauss_standard_dev, kernel_size , kernel_size, kernel_size) elif(nz == 2): kern = model_gauss(gauss_standar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smooth(image):\n image = convolve(image, gaussian2d(), mode='same')\n return image", "def smooth_image(self, image, mask):\n \n filter_size = self.smoothing_filter_size.value\n if filter_size == 0:\n return image\n sigma = filter_size / 2.35\n #\n # ...
[ "0.739436", "0.71233726", "0.70680994", "0.68737566", "0.6743445", "0.67295676", "0.65329146", "0.6494786", "0.64919174", "0.647246", "0.64332294", "0.6390439", "0.63026875", "0.61877143", "0.61825424", "0.61740756", "0.6155781", "0.61314356", "0.6101635", "0.6092838", "0.605...
0.69962204
3
Read an image from the disk or assign existing object to the output.
def get_image(imagename, nx = 0, ny = 1, nz = 1, im = 0): if type(imagename) == type(""): e = EMData() e.read_image(imagename, im) elif not imagename: e = EMData() if (nx > 0): e.set_size(nx, ny, nz) else: e = imagename return e
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self):\n with self.lock:\n return self.image", "def load(self):\n logger.debug(f\"Reading {self.path.name}\")\n self.label = int(Data.fromLabel(self.path.parent.name))\n self.image = skimg.data.imread(self.path)", "def read_from_filename(self, filename=''):\r\n ...
[ "0.6418173", "0.6256043", "0.62217027", "0.6114637", "0.5992335", "0.59468126", "0.59468126", "0.58881605", "0.5819111", "0.58140945", "0.58045965", "0.57723343", "0.5748826", "0.5742564", "0.5734244", "0.57320607", "0.5721345", "0.57174456", "0.56965464", "0.56918967", "0.56...
0.0
-1
Read an image from the disk stack, or return im's image from the list of images
def get_im(stackname, im = 0): if type(stackname) == type(""): e = EMData() e.read_image(stackname, im) return e else: return stackname[im].copy()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_image(path):\n img = misc.imread(path)\n return img", "def read_image():\n images = []\n for hand in os.listdir('images'):\n img = cv2.imread(os.path.join('images', hand))\n if img is not None:\n images.append(img)\n return images", "def image(images):\n retu...
[ "0.6800794", "0.6722553", "0.66451883", "0.6614246", "0.6607827", "0.6595313", "0.65405977", "0.653579", "0.64773405", "0.64660364", "0.64657694", "0.6447562", "0.6427345", "0.64263606", "0.64116603", "0.64041156", "0.6394776", "0.638916", "0.63824886", "0.6381627", "0.637192...
0.6380314
20
Return a NumPy array containing the image data.
def get_image_data(img): from EMAN2 import EMNumPy return EMNumPy.em2numpy(img)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_array(self) -> numpy.array:\r\n \r\n return self.pic_array", "def array_from_img(image):\n return np.array(image)", "def to_array(self):\n return np.array(self.to_image())", "def buffer(self) -> np.ndarray:\n return np.array(self._image_data, copy=False)", "def __array__(...
[ "0.78545177", "0.78410083", "0.77582353", "0.75947237", "0.7353946", "0.7335702", "0.7164609", "0.7154952", "0.7121806", "0.7093889", "0.7029067", "0.7018716", "0.7007183", "0.7005928", "0.7005361", "0.69826096", "0.6962062", "0.6913088", "0.69027466", "0.6895016", "0.6886627...
0.7611293
3
Get the in_plane angle from two images and output the crosss correlation value The function won't destroy input two images This is the angle that rotates the first image, ima, into the second image, ref. The sense of the rotation is clockwise. center=1 means image is first centered, then rotation angle is found
def get_inplane_angle(ima,ref, iring=1, fring=-1, ringstep=1, xtransSearch=0, ytransSearch=0, stp=1, center=1): from alignment import Numrinit, ringwe, Applyws, ormq from filter import fshift first_ring=int(iring); last_ring=int(fring); rstep=int(ringstep); xrng=int(xtransSearch); yrng=int(ytransSearch); step=int(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_opt_rotate(obj_img, back_img,\n back_center_x, back_center_y,\n obj_center_x, obj_center_y,\n prev_rot_angle=0.,\n is_erosion=False):\n width = obj_img.shape[0]\n rot_img = ndimage.rotate(obj_img, prev_rot_angle, reshape=False)\n...
[ "0.6499765", "0.64251083", "0.629712", "0.61103505", "0.594957", "0.58397025", "0.58203536", "0.57837665", "0.5770846", "0.57563686", "0.5699609", "0.5689523", "0.56460613", "0.56327623", "0.561697", "0.5562077", "0.5553344", "0.5546299", "0.5523779", "0.55019164", "0.5499139...
0.69551015
0
Return an image created from a text file. The first line of the image should contain "nx ny nz" (separated by whitespace) All subsequent lines contain "ix iy iz val", where ix, iy, and iz are the integer x, y, and z coordinates of the point and val is the floating point value of that point. All points not explicitly li...
def get_textimage(fname): from string import atoi,atof infile = open(fname) lines = infile.readlines() infile.close() data = lines[0].split() nx = atoi(data[0]) ny = atoi(data[1]) nz = atoi(data[2]) e = EMData() e.set_size(nx, ny, nz) e.to_zero() for line in lines[1:]: data = line.split() ix = a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_image(filename):\n try:\n fi = open(filename,\"r\")\n lines = fi.readlines()\n n = int(lines[0]);\n img = create_zeroed_image(n)\n for i,line in enumerate(lines[1:]):\n clean_line = line.strip() # remove whitespace and newlines\n for j,char in en...
[ "0.6697791", "0.6425697", "0.6267778", "0.60752165", "0.6063262", "0.6061974", "0.5948842", "0.5867118", "0.5839898", "0.5778474", "0.57653004", "0.56806886", "0.5678753", "0.56717163", "0.56614995", "0.5646917", "0.5627825", "0.56230605", "0.561317", "0.56094795", "0.5598929...
0.7201921
0
Extract input numbers from given string,
def get_input_from_string(str_input): from string import split res = [] list_input = split(str_input) for i in xrange(len(list_input)): res.append(float(list_input[i])) return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ExtractNumbers(s):\n\n t = s.strip('[]\\n')\n comma_space = r', '\n re_comma_space = re.compile(comma_space)\n z = re_comma_space.split(t)\n #print z\n return z", "def extract_nums(string):\r\n num_list = []\r\n mods1 = string.replace('$', '')\r\n mods2 = mods1.replace('K', '')\r\n...
[ "0.7238783", "0.7173874", "0.7057713", "0.68924135", "0.68546575", "0.67531013", "0.67403173", "0.6647867", "0.657946", "0.6577491", "0.65233153", "0.65192056", "0.6391088", "0.638495", "0.6383692", "0.6383132", "0.6349406", "0.6332319", "0.6319145", "0.6285752", "0.6280346",...
0.67156774
7
Calculate and print the descriptive statistics of an image.
def info(image, mask=None, Comment=""): if(Comment): print " *** ", Comment e = get_image(image) [mean, sigma, imin, imax] = Util.infomask(e, mask, True) nx = e.get_xsize() ny = e.get_ysize() nz = e.get_zsize() if (e.is_complex()): s = "" if e.is_shuffled(): s = " (shuffled)" if (e.is_fftodd()): p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_images_in_statistics(self):\n self._print_images_statistics(self._images_in_folder, self._pose_class_names)", "def print_image_info(image, resize=rsz_default, kernel=kernel_size):\n\tprint \"Image Size: {0}\".format(image.shape)\n\tprint \"Image Max: {0}\".format(image.max())\n\tprint \"Image Min: {...
[ "0.73849064", "0.7212866", "0.7087518", "0.70753783", "0.6967849", "0.68458074", "0.6760577", "0.674482", "0.6678487", "0.66494477", "0.6574271", "0.6533716", "0.64291257", "0.63930213", "0.6344323", "0.63426876", "0.63391554", "0.63218725", "0.63212085", "0.6293195", "0.6289...
0.6997572
4
Returns the inverse of the 2d rot and trans matrix
def inverse_transform2(alpha, tx = 0.0, ty = 0.0, mirror = 0): t = Transform({"type":"2D","alpha":alpha,"tx":tx,"ty":ty,"mirror":mirror,"scale":1.0}) t = t.inverse() t = t.get_params("2D") return t[ "alpha" ], t[ "tx" ], t[ "ty" ], t[ "mirror" ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inverse(self):\n return Rotation(self.matrix.transposed())", "def inverse(self):\n rotation_matrix = self.pose_mat[:3, :3]\n translation_vector = self.pose_mat[:3, 3]\n\n rot = np.transpose(rotation_matrix)\n trans = - np.matmul(np.transpose(rotation_matrix), translation_ve...
[ "0.76569027", "0.75310546", "0.7445371", "0.7406346", "0.7397322", "0.73486006", "0.72921807", "0.7276845", "0.7246478", "0.71603876", "0.71544224", "0.7151582", "0.708686", "0.7067885", "0.7064713", "0.7061624", "0.7057902", "0.70148677", "0.70069176", "0.69840884", "0.69755...
0.73712176
5
Returns the inverse of the 3d rot and trans matrix
def inverse_transform3(phi, theta=0.0, psi=0.0, tx=0.0, ty=0.0, tz=0.0, mirror = 0, scale=1.0): d = Transform({'type': 'spider', 'phi': phi, 'theta': theta, 'psi': psi, 'tx': tx, 'ty': ty, 'tz': tz, "mirror":mirror,"scale":scale}) d = d.inverse() d = d.get_params("spider") return d["phi"],d["theta"],d["psi"],d["t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inverse_rigid_trans(Tr): \n inv_Tr = np.zeros_like(Tr) # 3x4\n inv_Tr[0:3,0:3] = np.transpose(Tr[0:3,0:3])\n inv_Tr[0:3,3] = np.dot(-np.transpose(Tr[0:3,0:3]), Tr[0:3,3])\n return inv_Tr", "def inverse(self):\n rotation_matrix = self.pose_mat[:3, :3]\n translation_vector = self.pose...
[ "0.75761485", "0.7515526", "0.7423403", "0.7418693", "0.73657846", "0.7288308", "0.7254451", "0.7109498", "0.7077596", "0.7040509", "0.700391", "0.6975826", "0.6933009", "0.6900903", "0.68664896", "0.6786958", "0.6786305", "0.6780128", "0.6755011", "0.67143685", "0.6650445", ...
0.6268844
54
Create a list of available symmetries
def list_syms(): SymStringVec=[]; SymStringVec.append("CSYM"); SymStringVec.append("DSYM"); SymStringVec.append("TET_SYM"); SymStringVec.append("OCT_SYM"); SymStringVec.append("ICOS_SYM"); SymStringVec.append("ISYM"); return SymStringVec
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_symmetries(self):\n temp = self._properties.get('symmetries', [])\n return temp", "def __set_symbol_dict(self):\r\n return {0: list(alph) if self.is_case_snstv else list(alph)[:26],\r\n 1: list(dgt),\r\n 2: list(spcl) if self.is_spcl else []}", "def z2...
[ "0.7745224", "0.669557", "0.6515156", "0.63807356", "0.63562876", "0.6307514", "0.6297486", "0.6230556", "0.61550385", "0.6110371", "0.60140777", "0.600392", "0.58965176", "0.5893767", "0.5836222", "0.58326477", "0.5825521", "0.5808387", "0.57900697", "0.5775794", "0.57617795...
0.69593567
1
Create a centered circle (or sphere) having radius r.
def model_circle(r, nx, ny, nz=1): e = EMData() e.set_size(nx, ny, nz) e.process_inplace("testimage.circlesphere", {"radius":r, "fill":1}) return e
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_circle(x, y, r):\n\tnew_circle = Circle()\n\tnew_circle.x = x\n\tnew_circle.y = y\n\tnew_circle.r = r\n\treturn new_circle", "def create_circle(self, x, y, r, **kwargs):\n return self.create_oval(*self.circ_to_oval(x, y, r), **kwargs)", "def _generate_circle(self, center, radius):\n asse...
[ "0.769793", "0.7630966", "0.75068563", "0.73866713", "0.73565596", "0.7355884", "0.7321714", "0.72842544", "0.72638685", "0.72363985", "0.72306716", "0.72283244", "0.71910393", "0.7182544", "0.7088393", "0.7056075", "0.70258105", "0.6998519", "0.69953614", "0.69949824", "0.69...
0.73965037
3
Create a centered square (or cube) with edge length of d.
def model_square(d, nx, ny, nz=1): e = EMData() e.set_size(nx, ny, nz) e.process_inplace("testimage.squarecube", {"edge_length":d, "fill":1}) return e
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_square(d):asaasasassssssssssssssssssssssssss\n\t return (d ** 3)", "def initialize_d(d, square_sides, offset=0):\n return {key:[] for key in range(offset, square_sides ** 2 + offset)}", "def square_diamond(sx, sy, size, strong):\n if size == 1:\n return\n\n dsize ...
[ "0.5763527", "0.5631988", "0.55919534", "0.5325949", "0.52789533", "0.52779573", "0.5240144", "0.5220922", "0.5193584", "0.5174843", "0.5162735", "0.5129172", "0.5129167", "0.51191884", "0.5118387", "0.51183224", "0.50997084", "0.50534856", "0.50478446", "0.50203365", "0.4996...
0.63994324
0
Create a centered Gaussian image having standard deviation "sigma".
def model_gauss(xsigma, nx, ny=1, nz=1, ysigma=None, zsigma=None, xcenter=None, ycenter=None, zcenter=None): e = EMData() e.set_size(nx, ny, nz) if( ysigma == None ) : ysigma = xsigma if( zsigma == None ) : zsigma = xsigma if( xcenter == None ) : xcenter = nx//2 if( ycenter == None ) : ycenter = ny//2 if( zcen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_gaussian(size, sigma=10, center=None):\n\n x = np.arange(0, size[1], 1, float)\n y = np.arange(0, size[0], 1, float)\n y = y[:, np.newaxis]\n\n if center is None:\n x0 = y0 = size[0] // 2\n else:\n x0 = center[0]\n y0 = center[1]\n\n return np.exp(-4 * np.log(2) * ((...
[ "0.7622218", "0.76156443", "0.73544854", "0.71752834", "0.69022816", "0.68148255", "0.67936516", "0.6789439", "0.6705065", "0.66758764", "0.6667239", "0.66651136", "0.6639735", "0.65926224", "0.65801823", "0.6565116", "0.65491575", "0.6542619", "0.6531326", "0.6530046", "0.65...
0.6426071
29
create a cylinder along z axis
def model_cylinder(radius, nx, ny, nz): e = EMData() e.set_size(nx, ny, nz) e.process_inplace("testimage.cylinder", {"radius":radius}) return e
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cylinder(*args, axis: Union[List[float, float, float], bool]=None, caching: bool=True,\n degree: Union[int, bool]=3, endSweep: Union[float, bool]=2, heightRatio:\n Union[float, bool]=2.0, nodeState: Union[int, bool]=0, pivot: Union[List[float,\n float, float], bool]=None, ra...
[ "0.73577124", "0.7329743", "0.72503877", "0.6993126", "0.68925846", "0.68604624", "0.68472177", "0.67055696", "0.66552156", "0.6639137", "0.6544904", "0.6456661", "0.633183", "0.62076217", "0.61787236", "0.61410314", "0.6091397", "0.6059696", "0.6049184", "0.6046165", "0.6001...
0.62607145
13
Create an image of noise having standard deviation "sigma", and average 0.
def model_gauss_noise(sigma, nx, ny=1, nz=1): e = EMData() e.set_size(nx, ny, nz) e.process_inplace("testimage.noise.gauss", {"sigma":sigma}) return e
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_gaussian_noise(image, min_sigma, max_sigma):\n assert(max_sigma >= min_sigma)\n sigma = np.random.uniform(min_sigma, max_sigma)\n noise = np.random.normal(loc=0, scale=sigma, size=image.shape)\n noisy_im = np.floor((image + noise) * 255) / 255\n noisy_im = np.clip(noisy_im, 0, 1)\n return...
[ "0.7620322", "0.7568027", "0.73862773", "0.7340184", "0.70870167", "0.70391494", "0.69299024", "0.6861069", "0.6838096", "0.6838096", "0.682284", "0.6760456", "0.6759536", "0.67473197", "0.6671933", "0.66611886", "0.6641475", "0.66406924", "0.66172576", "0.6612591", "0.658642...
0.68094635
11
Create a blank image.
def model_blank(nx, ny=1, nz=1, bckg = 0.0): e = EMData() e.set_size(nx, ny, nz) e.to_zero() if( bckg != 0.0): e+=bckg return e
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _blankimage():\n img = TK.PhotoImage(width=1, height=1)\n img.blank()\n return img", "def create_empty_image(width=512, height=512):\n blank_img = np.zeros((width, height, 3), np.uint8)\n # Return instance of the class\n return ExtendedImage(blank_img)", "def blank...
[ "0.80658996", "0.789249", "0.73570555", "0.719231", "0.71430326", "0.7110544", "0.69541055", "0.69369465", "0.69369465", "0.69088554", "0.69088554", "0.6905223", "0.6859873", "0.6651872", "0.65808094", "0.65179014", "0.6485663", "0.64796895", "0.6460028", "0.6458123", "0.6395...
0.0
-1
Parse a Spider filename string and insert parameters.
def parse_spider_fname(mystr, *fieldvals): # helper functions and classes def rm_stack_char(mystr): "Helper function to remove a stack character if it exists" stackloc = mystr.find("@") if stackloc != -1: # there's an '@' somewhere if len(mystr) - 1 == stackloc: # It's at the end of the string re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_filename(cls, filename):\n words = filename.split('_')\n return words[0], int(words[1][1:]), int(words[2])", "def parseFileName(filename):\n entry = DataEntry(\"\",0,{},{},0,0)\n wordArray = filename.split(\".\")\n entry.publication_name = wordArray[1]\n entry.year = wordArray...
[ "0.5459443", "0.5448573", "0.5429191", "0.52798533", "0.5271916", "0.5247543", "0.52416116", "0.5215298", "0.51574737", "0.5120585", "0.5072528", "0.5036985", "0.5022814", "0.4980182", "0.49415386", "0.4940157", "0.49290508", "0.49222475", "0.49006563", "0.48977634", "0.48940...
0.5895396
0
Print the data in slice iz, row ix of an image to standard out.
def print_row(input, ix=0, iz=0): image=get_image(input) nx = image.get_xsize() ny = image.get_ysize() nz = image.get_zsize() print "(z = %d slice, x = %d row)" % (iz, ix) line = [] for iy in xrange(ny): line.append("%12.5g " % (image.get_value_at(ix,iy,iz))) if ((iy + 1) % 5 == 0): line.append("\n ") li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_image_row(input, iy=0, iz=0):\n\timage=get_image(input)\n\tnx = image.get_xsize()\n\tny = image.get_ysize()\n\tnz = image.get_zsize()\n\tprint \"(z = %d slice, y = %d col)\" % (iz, iy)\n\tline = []\n\tfor ix in xrange(nx):\n\t\tline.append(\"%12.5g \" % (image.get_value_at(ix,iy,iz)))\n\t\tif ((ix + 1) ...
[ "0.75990057", "0.7544907", "0.74450433", "0.73937047", "0.7349031", "0.7347187", "0.7033798", "0.68403655", "0.6811467", "0.66571254", "0.6630757", "0.6279358", "0.6275334", "0.61232245", "0.60401046", "0.5973948", "0.5973784", "0.5965042", "0.59583265", "0.59162855", "0.5894...
0.76172984
0
Print the data in slice iz, column iy of an image to standard out.
def print_col(input, iy=0, iz=0): image=get_image(input) nx = image.get_xsize() ny = image.get_ysize() nz = image.get_zsize() print "(z = %d slice, y = %d col)" % (iz, iy) line = [] for ix in xrange(nx): line.append("%12.5g " % (image.get_value_at(ix,iy,iz))) if ((ix + 1) % 5 == 0): line.append("\n ") li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_image_col(input, ix=0, iz=0):\n\timage=get_image(input)\n\tnx = image.get_xsize()\n\tny = image.get_ysize()\n\tnz = image.get_zsize()\n\tprint \"(z = %d slice, x = %d row)\" % (iz, ix)\n\tline = []\n\tfor iy in xrange(ny):\n\t\tline.append(\"%12.5g \" % (image.get_value_at(ix,iy,iz)))\n\t\tif ((iy + 1) ...
[ "0.77487314", "0.750461", "0.7496404", "0.73919225", "0.7150529", "0.7141496", "0.7027633", "0.6667874", "0.66633767", "0.6654244", "0.6348636", "0.621092", "0.6179944", "0.60063565", "0.59464717", "0.59386533", "0.5911687", "0.58938134", "0.5851181", "0.58338124", "0.5803081...
0.75519806
1
Print the data in slice iz of an image to standard out.
def print_slice(input, iz=0): image=get_image(input) nx = image.get_xsize() ny = image.get_ysize() nz = image.get_zsize() print "(z = %d slice)" % (iz) line = [] for iy in xrange(ny): line.append("Row ") line.append("%4i " % iy) for ix in xrange(nx): line.append("%12.5g " % (image.get_value_at(ix,iy,iz...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_image_slice(input, iz=0):\n\timage=get_image(input)\n\tnx = image.get_xsize()\n\tny = image.get_ysize()\n\tnz = image.get_zsize()\n\tprint \"(z = %d slice)\" % (iz)\n\tline = []\n\tfor iy in xrange(ny-1,-1,-1):\n\t\tline.append(\"Row \")\n\t\tline.append(\"%4i \" % iy)\n\t\tfor ix in xrange(nx):\n\t\t\tl...
[ "0.7832976", "0.7438628", "0.72238773", "0.70643157", "0.70205015", "0.6971101", "0.659192", "0.65685576", "0.6525086", "0.64007616", "0.6349104", "0.6105353", "0.6058925", "0.6016299", "0.60077834", "0.59170806", "0.5827092", "0.5820637", "0.5805464", "0.58032835", "0.574112...
0.7674774
1
Print the data in an image to standard out.
def print_image(input): image=get_image(input) nz = image.get_zsize() for iz in xrange(nz): print_slice(input, iz)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printImage(imageObject):\n # TODO\n pass", "def print_img_data(img,title='Image'):\n print(f'________ {title} _______')\n if len(image.shape) == 2:\n print(f'min:{img.min()} max:{img.max()} shape:{img.shape}\\\n\\nmean:{img.mean()} std:{img.std()} type:{type(img[0,0])}\\n')\n elif l...
[ "0.75263417", "0.74676603", "0.74178773", "0.71454406", "0.70787203", "0.70770824", "0.6925922", "0.68538165", "0.6828833", "0.680339", "0.678513", "0.6639985", "0.6579925", "0.65075237", "0.64939463", "0.6484506", "0.6398455", "0.6392404", "0.63622975", "0.6340637", "0.63262...
0.7227022
3