bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def write_sitemaps(): """ This function will write a sitemap index file that references individual sitemaps for all the batches, issues, pages and titles that have been loaded. """ sitemap_index = open( os.path.join(settings.DOCUMENT_ROOT, 'sitemap.xml'), 'w') sitemap_index.write('<?xml version="1.0" encoding="UTF-8"?>... | def write_sitemaps(): """ This function will write a sitemap index file that references individual sitemaps for all the batches, issues, pages and titles that have been loaded. """ sitemap_index = open( os.path.join(settings.DOCUMENT_ROOT, 'sitemap.xml'), 'w') sitemap_index.write('<?xml version="1.0" encoding="UTF-8"?>... | 445,800 |
def write_sitemaps(): """ This function will write a sitemap index file that references individual sitemaps for all the batches, issues, pages and titles that have been loaded. """ sitemap_index = open( os.path.join(settings.DOCUMENT_ROOT, 'sitemap.xml'), 'w') sitemap_index.write('<?xml version="1.0" encoding="UTF-8"?>... | def write_sitemaps(): """ This function will write a sitemap index file that references individual sitemaps for all the batches, issues, pages and titles that have been loaded. """ sitemap_index = open( os.path.join(settings.DOCUMENT_ROOT, 'sitemap.xml'), 'w') sitemap_index.write('<?xml version="1.0" encoding="UTF-8"?>... | 445,801 |
def write_sitemaps(): """ This function will write a sitemap index file that references individual sitemaps for all the batches, issues, pages and titles that have been loaded. """ sitemap_index = open( os.path.join(settings.DOCUMENT_ROOT, 'sitemap.xml'), 'w') sitemap_index.write('<?xml version="1.0" encoding="UTF-8"?>... | def write_sitemaps(): """ This function will write a sitemap index file that references individual sitemaps for all the batches, issues, pages and titles that have been loaded. """ sitemap_index = open( os.path.join(settings.DOCUMENT_ROOT, 'sitemap.xml'), 'w') sitemap_index.write('<?xml version="1.0" encoding="UTF-8"?>... | 445,802 |
def title(request, lccn): title = get_object_or_404(models.Title, lccn=lccn) page_title = "About this Newspaper: %s" % unicode(title.name) # we call these here, because the query the db, they are not # cached by django's ORM, and we have some conditional logic # in the template that would result in them getting called ... | deforg_text = html.escape(note.text) title(request,org_text = html.escape(note.text) lccn):org_text = html.escape(note.text) titleorg_text = html.escape(note.text) =org_text = html.escape(note.text) get_object_or_404(models.Title,org_text = html.escape(note.text) lccn=lccn)org_text = html.escape(note.text) page_titleor... | 445,803 |
def title(request, lccn): title = get_object_or_404(models.Title, lccn=lccn) page_title = "About this Newspaper: %s" % unicode(title.name) # we call these here, because the query the db, they are not # cached by django's ORM, and we have some conditional logic # in the template that would result in them getting called ... | def title(request, lccn): title = get_object_or_404(models.Title, lccn=lccn) page_title = "About this Newspaper: %s" % unicode(title.name) # we call these here, because the query the db, they are not # cached by django's ORM, and we have some conditional logic # in the template that would result in them getting called ... | 445,804 |
def write_sitemaps(): """ This function will write a sitemap index file that references individual sitemaps for all the batches, issues, pages and titles that have been loaded. """ sitemap_index = open( os.path.join(settings.DOCUMENT_ROOT, 'sitemap.xml'), 'w') sitemap_index.write('<?xml version="1.0" encoding="UTF-8"?>... | def write_sitemaps(): """ This function will write a sitemap index file that references individual sitemaps for all the batches, issues, pages and titles that have been loaded. """ sitemap_index = open( os.path.join(settings.DOCUMENT_ROOT, 'sitemap.xml'), 'w') sitemap_index.write('<?xml version="1.0" encoding="UTF-8"?>... | 445,805 |
def write_sitemaps(): """ This function will write a sitemap index file that references individual sitemaps for all the batches, issues, pages and titles that have been loaded. """ sitemap_index = open( os.path.join(settings.DOCUMENT_ROOT, 'sitemap.xml'), 'w') sitemap_index.write('<?xml version="1.0" encoding="UTF-8"?>... | def write_sitemaps(): """ This function will write a sitemap index file that references individual sitemaps for all the batches, issues, pages and titles that have been loaded. """ sitemap_index = open( os.path.join(settings.DOCUMENT_ROOT, 'sitemap.xml'), 'w') sitemap_index.write('<?xml version="1.0" encoding="UTF-8"?>... | 445,806 |
def handle(self, flickr_key, **options): _log.debug("looking for chronam page content on flickr") for flickr_url, chronam_url in flickr_chronam_links(): _log.info("found flickr/chronam link: %s, %s" % (flickr_url, chronam_url)) path = urlparse(chronam_url).path page = Page.lookup(path) if page: f, created = FlickrUrl.o... | def handle(self, flickr_key, **options): _log.debug("looking for chronam page content on flickr") for flickr_url, chronam_url in flickr_chronam_links(flickr_key): _log.info("found flickr/chronam link: %s, %s" % (flickr_url, chronam_url)) path = urlparse(chronam_url).path page = Page.lookup(path) if page: f, created = F... | 445,807 |
def handle(self, **options): if not (models.Title.objects.all().count() and \ models.Holding.objects.all().count() and \ models.Essay.objects.all().count() and \ models.Batch.objects.all().count() and \ models.Issue.objects.all().count() and \ models.Page.objects.all().count() and \ index.page_count() and \ index.title... | def handle(self, **options): if not (models.Title.objects.all().count()==0 and \ models.Holding.objects.all().count()==0 and \ models.Essay.objects.all().count()==0 and \ models.Batch.objects.all().count()==0 and \ models.Issue.objects.all().count()==0 and \ models.Page.objects.all().count()==0 and \ index.page_count()... | 445,808 |
def test_kv_predictors(): from pyrticle.distribution import \ ChargelessKVRadiusPredictor, KVRadiusPredictor kv_env_exact = ChargelessKVRadiusPredictor(2.5e-3, 5e-6) kv_env_num = KVRadiusPredictor(2.5e-3, 5e-6) from hedge.tools import plot_1d steps = 50 for i in range(steps): s = kv_env_num.dt/7*i a_exact = kv_env_ex... | def test_kv_predictors(): from pyrticle.distribution import \ ChargelessKVRadiusPredictor, KVRadiusPredictor kv_env_exact = ChargelessKVRadiusPredictor(2.5e-3, 5e-6) kv_env_num = KVRadiusPredictor(2.5e-3, 5e-6) steps = 50 for i in range(steps): s = kv_env_num.dt/7*i a_exact = kv_env_exact(s) a_num = kv_env_num(s) ass... | 445,809 |
def set_radius(r): method.depositor.set_shape_function( state, method.get_shape_function_class() (r, method.mesh_data.dimensions, exponent,)) | def set_radius(r): method.depositor.set_shape_function( state, method.get_shape_function_class() (r, method.mesh_data.dimensions, exponent,)) | 445,810 |
def prepare_average_groups(self): discr = self.method.discretization | def prepare_average_groups(self): discr = self.method.discretization | 445,811 |
def make_pointwise_interpolation_matrix(self, eog, eg, el, ldis, svd, scaled_vdm, basis_subset=None): u, s, vt = svd | def make_pointwise_interpolation_matrix(self, eog, eg, el, ldis, svd, scaled_vdm, basis_subset=None): u, s, vt = svd | 445,812 |
def prepare_with_pointwise_projection_and_basis_reduction(self): discr = self.method.discretization backend = self.backend | def prepare_with_pointwise_projection_and_basis_reduction(self): discr = self.method.discretization backend = self.backend | 445,813 |
def prepare_with_pointwise_projection_and_basis_reduction(self): discr = self.method.discretization backend = self.backend | def prepare_with_pointwise_projection_and_basis_reduction(self): discr = self.method.discretization backend = self.backend | 445,814 |
def _deposit_j(self, state, velocities, pslice): return self.remap_grid_to_mesh(self.deposit_grid_j( state, velocities, pslice)) | def _deposit_j(self, state, velocities, pslice): return self.remap_grid_to_mesh(self.deposit_grid_j( state, velocities, pslice)) | 445,815 |
def bounding_box(tuples): assert tuples l = len(tuples[0]) return [(min(t[i] for t in tuples), max(t[i] for t in tuples)) for i in range(l)] | def bounding_box(tuples): assert tuples l = len(tuples[0]) return [(min(t[i] for t in tuples), max(t[i] for t in tuples)) for i in range(l)] | 445,816 |
def make_inverse_mesh_info(rz, radial_subdiv): # chop off points with zero radius while rz[0][0] == 0: rz.pop(0) while rz[-1][0] == 0: rz.pop(-1) # construct outer cylinder ((min_r, max_r), (min_z, max_z)) = bounding_box(rz) if rz[0][1] < rz[-1][1]: # built in positive z direction rz.extend([ (max_r+2, max_z), (max_r... | def make_inverse_mesh_info(rz, radial_subdiv): # chop off points with zero radius while rz[0][0] == 0: rz.pop(0) while rz[-1][0] == 0: rz.pop(-1) # construct outer cylinder ((min_r, max_r), (min_z, max_z)) = bounding_box(rz) if rz[0][1] < rz[-1][1]: # built in positive z direction rz.extend([ (max_r+2, max_z), (max_r... | 445,817 |
def make_inverse_mesh_info(rz, radial_subdiv): # chop off points with zero radius while rz[0][0] == 0: rz.pop(0) while rz[-1][0] == 0: rz.pop(-1) # construct outer cylinder ((min_r, max_r), (min_z, max_z)) = bounding_box(rz) if rz[0][1] < rz[-1][1]: # built in positive z direction rz.extend([ (max_r+2, max_z), (max_r... | def make_inverse_mesh_info(rz, radial_subdiv): # chop off points with zero radius while rz[0][0] == 0: rz.pop(0) while rz[-1][0] == 0: rz.pop(-1) # construct outer cylinder ((min_r, max_r), (min_z, max_z)) = bounding_box(rz) if rz[0][1] < rz[-1][1]: # built in positive z direction rz.extend([ (max_r+2, max_z), (max_r... | 445,818 |
def run_kv3d(): O = ConstructorPlaceholder timestamp = get_timestamp() for chi in [None, 2]: for rec in [ O("DepShape"), O("DepGrid", O("FineCoreBrickGenerator", core_axis=2), #el_tolerance=0.1, method="simplex_reduce") ]: job = BatchJob( "kv3d-$DATE/%s-chi%s" % (cn(rec), chi), "-m pyrticle.driver", aux_files=["kv3d.... | def run_kv3d(): O = ConstructorPlaceholder timestamp = get_timestamp() for chi in [None, 2]: for rec in [ O("DepShape"), O("DepGrid", O("FineCoreBrickGenerator", core_axis=2), #el_tolerance=0.1, submethod="simplex_reduce") ]: job = BatchJob( "kv3d-$DATE/%s-chi%s" % (cn(rec), chi), "-m pyrticle.driver", aux_files=["kv... | 445,819 |
def op_template(self): from hedge.tools import join_fields from hedge.optemplate import Field, make_vector_field, BoundaryPair, \ BoundarizeOperator, make_normal, get_flux_operator, \ make_nabla, InverseMassOperator | def op_template(self): from hedge.tools import join_fields from hedge.optemplate import Field, make_vector_field, BoundaryPair, \ BoundarizeOperator, make_normal, get_flux_operator, \ make_nabla, InverseMassOperator | 445,820 |
def __init__(self, method, particle_count=None, containing_elements=None, positions=None, momenta=None, charges=None, masses=None, depositor_state=None, pusher_state=None, pnss=None, vis_listener=None, ): state_class = getattr(_internal, "ParticleState%s" % method.get_dimensionality_suffix()) | def __init__(self, method, particle_count=None, containing_elements=None, positions=None, momenta=None, charges=None, masses=None, depositor_state=None, pusher_state=None, pnss=None, vis_listener=None, ): state_class = getattr(_internal, "ParticleState%s" % method.get_dimensionality_suffix()) | 445,821 |
def __call__(self, t, fields_f, state_f): # calculate EM right-hand side sub_timer = self.field_solve_timer.start_sub_timer() | def __call__(self, t, fields_f, state_f): # calculate EM right-hand side sub_timer = self.field_solve_timer.start_sub_timer() | 445,822 |
def __call__(self, t, fields_f, state_f): # calculate EM right-hand side sub_timer = self.field_solve_timer.start_sub_timer() | def __call__(self, t, fields_f, state_f): # calculate EM right-hand side sub_timer = self.field_solve_timer.start_sub_timer() | 445,823 |
def __call__(self, t, fields_f, state_f): from pyrticle._internal import ZeroVector | def __call__(self, t, fields_f, state_f): from pyrticle._internal import ZeroVector | 445,824 |
def __call__(self, t, fields_f, state_f): state = state_f() | def __call__(self, t, fields_f, state_f): state = state_f() | 445,825 |
def __call__(self, t, fields_f, state_f): state = state_f() | def __call__(self, t, fields_f, state_f): state = state_f() | 445,826 |
def __call__(self, t, fields_f, state_f): state = state_f() | def __call__(self, t, fields_f, state_f): state = state_f() | 445,827 |
def __init__(self, discr, units, depositor, pusher, dimensions_pos, dimensions_velocity, debug=set()): | def __init__(self, discr, units, depositor, pusher, dimensions_pos, dimensions_velocity, debug=set()): | 445,828 |
def add_particles(self, state, iterable, maxcount=None): """Add the particles from C{iterable} to the cloud. C{iterable} is expected to yield tuples C{(position, velocity, charge, mass)}. If C{maxcount} is specified, maximally C{maxcount} particles are obtained from the iterable. """ | def add_particles(self, state, iterable, maxcount=None): """Add the particles from C{iterable} to the cloud. C{iterable} is expected to yield tuples C{(position, velocity, charge, mass)}. If C{maxcount} is specified, maximally C{maxcount} particles are obtained from the iterable. """ | 445,829 |
def add_particles(self, state, iterable, maxcount=None): """Add the particles from C{iterable} to the cloud. C{iterable} is expected to yield tuples C{(position, velocity, charge, mass)}. If C{maxcount} is specified, maximally C{maxcount} particles are obtained from the iterable. """ | def add_particles(self, state, iterable, maxcount=None): """Add the particles from C{iterable} to the cloud. C{iterable} is expected to yield tuples C{(position, velocity, charge, mass)}. If C{maxcount} is specified, maximally C{maxcount} particles are obtained from the iterable. """ | 445,830 |
def add_particles(self, state, iterable, maxcount=None): """Add the particles from C{iterable} to the cloud. C{iterable} is expected to yield tuples C{(position, velocity, charge, mass)}. If C{maxcount} is specified, maximally C{maxcount} particles are obtained from the iterable. """ | def add_particles(self, state, iterable, maxcount=None): """Add the particles from C{iterable} to the cloud. C{iterable} is expected to yield tuples C{(position, velocity, charge, mass)}. If C{maxcount} is specified, maximally C{maxcount} particles are obtained from the iterable. """ | 445,831 |
def check_containment(self, state): """Check that a containing element is known for each particle. | def check_containment(self, state): """Check that a containing element is known for each particle. | 445,832 |
def check_containment(self, state): """Check that a containing element is known for each particle. | def check_containment(self, state): """Check that a containing element is known for each particle. | 445,833 |
def deposit_densities(self, state): """Return a tuple (charge_density, current_densities), where current_densities is an d-by-n array, where d is the number of velocity dimensions, and n is the discretization nodes. """ def all_getter(): rho, j = self.depositor.deposit_densities(state, self.velocities()) j = numpy.asar... | def deposit_densities(self, state): """Return a tuple (charge_density, current_densities), where current_densities is an d-by-n array, where d is the number of velocity dimensions, and n is the discretization nodes. """ def all_getter(): rho, j = self.depositor.deposit_densities(state, self.velocities()) j = numpy.asar... | 445,834 |
def deposit_j(self, state): """Return a the current densities as an d-by-n array, where d is the number of velocity dimensions, and n is the number of discretization nodes. """ | def deposit_j(self, state): """Return a the current densities as an d-by-n array, where d is the number of velocity dimensions, and n is the number of discretization nodes. """ | 445,835 |
def note_boundary_hit(subself, pn): _internal.kill_particle( new_state.particle_state, pn, new_state.particle_number_shift_signaller) | def note_boundary_hit(subself, pn): _internal.kill_particle( new_state.particle_state, pn, new_state.particle_number_shift_signaller) | 445,836 |
def note_boundary_hit(subself, pn): _internal.kill_particle( new_state.particle_state, pn, new_state.particle_number_shift_signaller) | def note_boundary_hit(subself, pn): _internal.kill_particle( new_state.particle_state, pn, new_state.particle_number_shift_signaller) | 445,837 |
def _add_to_silo(self, visualizer, db, state, time, step, beamaxis, vis_listener=None): from pylo import DBOPT_DTIME, DBOPT_CYCLE from warnings import warn | def _add_to_silo(self, visualizer, db, state, time, step, beamaxis, vis_listener=None): from pylo import DBOPT_DTIME, DBOPT_CYCLE from warnings import warn | 445,838 |
def _add_to_silo(self, visualizer, db, state, time, step, beamaxis, vis_listener=None): from pylo import DBOPT_DTIME, DBOPT_CYCLE from warnings import warn | def _add_to_silo(self, visualizer, db, state, time, step, beamaxis, vis_listener=None): from pylo import DBOPT_DTIME, DBOPT_CYCLE from warnings import warn | 445,839 |
def _add_to_silo(self, visualizer, db, state, time, step, beamaxis, vis_listener=None): from pylo import DBOPT_DTIME, DBOPT_CYCLE from warnings import warn | def _add_to_silo(self, visualizer, db, state, time, step, beamaxis, vis_listener=None): from pylo import DBOPT_DTIME, DBOPT_CYCLE from warnings import warn | 445,840 |
def _add_to_silo(self, visualizer, db, state, time, step, beamaxis, vis_listener=None): from pylo import DBOPT_DTIME, DBOPT_CYCLE from warnings import warn | def _add_to_silo(self, visualizer, db, state, time, step, beamaxis, vis_listener=None): from pylo import DBOPT_DTIME, DBOPT_CYCLE from warnings import warn | 445,841 |
def _add_to_silo(self, visualizer, db, state, time, step, beamaxis, vis_listener=None): from pylo import DBOPT_DTIME, DBOPT_CYCLE from warnings import warn | def _add_to_silo(self, visualizer, db, state, time, step, beamaxis, vis_listener=None): from pylo import DBOPT_DTIME, DBOPT_CYCLE from warnings import warn | 445,842 |
def _add_to_silo(self, visualizer, db, state, time, step, beamaxis, vis_listener=None): from pylo import DBOPT_DTIME, DBOPT_CYCLE from warnings import warn | def _add_to_silo(self, visualizer, db, state, time, step, beamaxis, vis_listener=None): from pylo import DBOPT_DTIME, DBOPT_CYCLE from warnings import warn | 445,843 |
def _add_to_silo(self, visualizer, db, state, time, step, beamaxis, vis_listener=None): from pylo import DBOPT_DTIME, DBOPT_CYCLE from warnings import warn | def _add_to_silo(self, visualizer, db, state, time, step, beamaxis, vis_listener=None): from pylo import DBOPT_DTIME, DBOPT_CYCLE from warnings import warn | 445,844 |
def optimize_shape_bandwidth(method, state, analytic_rho, exponent): discr = method.discretization rec = method.depositor adv_radius = method.mesh_data.advisable_particle_radius() radii = [adv_radius*2**i for i in numpy.linspace(-4, 2, 50)] def set_radius(r): method.depositor.set_shape_function( state, method.get_sha... | def optimize_shape_bandwidth(method, state, analytic_rho, exponent): discr = method.discretization rec = method.depositor adv_radius = method.mesh_data.advisable_particle_radius() radii = [adv_radius*2**i for i in numpy.linspace(-4, 2, 50)] def set_radius(r): method.depositor.set_shape_function( state, method.get_sha... | 445,845 |
def set_radius(r): method.depositor.set_shape_function( state, method.get_shape_function_class() (r, method.mesh_data.dimensions, exponent,)) | def set_radius(r): method.depositor.set_shape_function( state, method.get_shape_function_class() (r, method.mesh_data.dimensions, exponent,)) | 445,846 |
def set_radius(r): method.depositor.set_shape_function( state, method.get_shape_function_class() (r, method.mesh_data.dimensions, exponent,)) | def set_radius(r): method.depositor.set_shape_function( state, method.get_shape_function_class() (r, method.mesh_data.dimensions, exponent,)) | 445,847 |
def is_local_minimum(list, i): if i == 0: return False elif i == len(list)-1: return False else: return list[i] < list[i-1] and list[i] < list[i+1] | def is_local_minimum(list, i): if i == 0: return False elif i == len(list)-1: return False else: return list[i] < list[i-1] and list[i] < list[i+1] | 445,848 |
def make_scaling_matrix(beta_scale, other_scale): if la.norm(mean_beta) < 1e-10: return other_scale*numpy.eye(discr.dimensions) else: beta_unit = mean_beta/la.norm(mean_beta) return (other_scale*numpy.identity(discr.dimensions) + (beta_scale-other_scale)*numpy.outer(beta_unit, beta_unit)) | def make_scaling_matrix(beta_scale, other_scale): if la.norm(mean_beta) < 1e-10: return other_scale*numpy.eye(discr.dimensions) else: beta_unit = mean_beta/la.norm(mean_beta) return (other_scale*numpy.identity(discr.dimensions) + (beta_scale-other_scale)*numpy.outer(beta_unit, beta_unit)) | 445,849 |
def make_scaling_matrix(beta_scale, other_scale): if la.norm(mean_beta) < 1e-10: return other_scale*numpy.eye(discr.dimensions) else: beta_unit = mean_beta/la.norm(mean_beta) return (other_scale*numpy.identity(discr.dimensions) + (beta_scale-other_scale)*numpy.outer(beta_unit, beta_unit)) | def make_scaling_matrix(beta_scale, other_scale): if la.norm(mean_beta) < 1e-10: return other_scale*numpy.eye(discr.dimensions) else: beta_unit = mean_beta/la.norm(mean_beta) return (other_scale*numpy.identity(discr.dimensions) + (beta_scale-other_scale)*numpy.outer(beta_unit, beta_unit)) | 445,850 |
def make_scaling_matrix(beta_scale, other_scale): if la.norm(mean_beta) < 1e-10: return other_scale*numpy.eye(discr.dimensions) else: beta_unit = mean_beta/la.norm(mean_beta) return (other_scale*numpy.identity(discr.dimensions) + (beta_scale-other_scale)*numpy.outer(beta_unit, beta_unit)) | def make_scaling_matrix(beta_scale, other_scale): if la.norm(mean_beta) < 1e-10: return other_scale*numpy.eye(discr.dimensions) else: beta_unit = mean_beta/la.norm(mean_beta) return (other_scale*numpy.identity(discr.dimensions) + (beta_scale-other_scale)*numpy.outer(beta_unit, beta_unit)) | 445,851 |
def make_scaling_matrix(beta_scale, other_scale): if la.norm(mean_beta) < 1e-10: return other_scale*numpy.eye(discr.dimensions) else: beta_unit = mean_beta/la.norm(mean_beta) return (other_scale*numpy.identity(discr.dimensions) + (beta_scale-other_scale)*numpy.outer(beta_unit, beta_unit)) | def make_scaling_matrix(beta_scale, other_scale): if la.norm(mean_beta) < 1e-10: return other_scale*numpy.eye(discr.dimensions) else: beta_unit = mean_beta/la.norm(mean_beta) return (other_scale*numpy.identity(discr.dimensions) + (beta_scale-other_scale)*numpy.outer(beta_unit, beta_unit)) | 445,852 |
def make_scaling_matrix(beta_scale, other_scale): if la.norm(mean_beta) < 1e-10: return other_scale*numpy.eye(discr.dimensions) else: beta_unit = mean_beta/la.norm(mean_beta) return (other_scale*numpy.identity(discr.dimensions) + (beta_scale-other_scale)*numpy.outer(beta_unit, beta_unit)) | def make_scaling_matrix(beta_scale, other_scale): if la.norm(mean_beta) < 1e-10: return other_scale*numpy.eye(discr.dimensions) else: beta_unit = mean_beta/la.norm(mean_beta) return (other_scale*numpy.identity(discr.dimensions) + (beta_scale-other_scale)*numpy.outer(beta_unit, beta_unit)) | 445,853 |
def make_scaling_matrix(beta_scale, other_scale): if la.norm(mean_beta) < 1e-10: return other_scale*numpy.eye(discr.dimensions) else: beta_unit = mean_beta/la.norm(mean_beta) return (other_scale*numpy.identity(discr.dimensions) + (beta_scale-other_scale)*numpy.outer(beta_unit, beta_unit)) | def make_scaling_matrix(beta_scale, other_scale): if la.norm(mean_beta) < 1e-10: return other_scale*numpy.eye(discr.dimensions) else: beta_unit = mean_beta/la.norm(mean_beta) return (other_scale*numpy.identity(discr.dimensions) + (beta_scale-other_scale)*numpy.outer(beta_unit, beta_unit)) | 445,854 |
def make_scaling_matrix(beta_scale, other_scale): if la.norm(mean_beta) < 1e-10: return other_scale*numpy.eye(discr.dimensions) else: beta_unit = mean_beta/la.norm(mean_beta) return (other_scale*numpy.identity(discr.dimensions) + (beta_scale-other_scale)*numpy.outer(beta_unit, beta_unit)) | def make_scaling_matrix(beta_scale, other_scale): if la.norm(mean_beta) < 1e-10: return other_scale*numpy.eye(discr.dimensions) else: beta_unit = mean_beta/la.norm(mean_beta) return (other_scale*numpy.identity(discr.dimensions) + (beta_scale-other_scale)*numpy.outer(beta_unit, beta_unit)) | 445,855 |
def make_scaling_matrix(beta_scale, other_scale): if la.norm(mean_beta) < 1e-10: return other_scale*numpy.eye(discr.dimensions) else: beta_unit = mean_beta/la.norm(mean_beta) return (other_scale*numpy.identity(discr.dimensions) + (beta_scale-other_scale)*numpy.outer(beta_unit, beta_unit)) | def make_scaling_matrix(beta_scale, other_scale): if la.norm(mean_beta) < 1e-10: return other_scale*numpy.eye(discr.dimensions) else: beta_unit = mean_beta/la.norm(mean_beta) return (other_scale*numpy.identity(discr.dimensions) + (beta_scale-other_scale)*numpy.outer(beta_unit, beta_unit)) | 445,856 |
def make_scaling_matrix(beta_scale, other_scale): if la.norm(mean_beta) < 1e-10: return other_scale*numpy.eye(discr.dimensions) else: beta_unit = mean_beta/la.norm(mean_beta) return (other_scale*numpy.identity(discr.dimensions) + (beta_scale-other_scale)*numpy.outer(beta_unit, beta_unit)) | def make_scaling_matrix(beta_scale, other_scale): if la.norm(mean_beta) < 1e-10: return other_scale*numpy.eye(discr.dimensions) else: beta_unit = mean_beta/la.norm(mean_beta) return (other_scale*numpy.identity(discr.dimensions) + (beta_scale-other_scale)*numpy.outer(beta_unit, beta_unit)) | 445,857 |
def __init__(self): _internal.NumberShiftListener.__init__(self) from weakref import WeakKeyDictionary self.subscribers = WeakKeyDictionary() | def __init__(self, name=None): _internal.NumberShiftListener.__init__(self) from weakref import WeakKeyDictionary self.subscribers = WeakKeyDictionary() | 445,858 |
def __init__(self, t0, y0, dt): self.t = [t0] self.y = [y0] self.dt = dt | def __init__(self, t0, y0, dt): self.t = [t0] self.y = [y0] self.dt = dt | 445,859 |
def set_radius(r): method.depositor.set_shape_function( state, method.get_shape_function_class() (r, method.mesh_data.dimensions, exponent,)) | def set_radius(r): method.depositor.set_shape_function( state, method.get_shape_function_class() (r, method.mesh_data.dimensions, exponent,)) | 445,860 |
def make_glued_rect_mesh(a=(0,0), b=(1,1), max_area=None, boundary_tagger=(lambda fvi, el, fn, points: []), periodicity=None, subdivisions=None, refine_func=None): """Create two unstructured rectangular meshes, side-by-side. @arg a: the lower left hand point of the base rectangle @arg b: the upper right hand point of ... | def make_glued_rect_mesh(a=(0,0), b=(1,1), max_area=None, boundary_tagger=(lambda fvi, el, fn, points: []), periodicity=None, subdivisions=None, refine_func=None): """Create two unstructured rectangular meshes, side-by-side. @arg a: the lower left hand point of the base rectangle @arg b: the upper right hand point of ... | 445,861 |
def refine_func(vertices, area): return area > max_area | def refine_func(vertices, area): return area > max_area | 445,862 |
def refine_func(vertices, area): return area > max_area | def refine_func(vertices, area): return area > max_area | 445,863 |
def refine_func(vertices, area): return area > max_area | def refine_func(vertices, area): return area > max_area | 445,864 |
def refine_func(vertices, area): return area > max_area | def refine_func(vertices, area): return area > max_area | 445,865 |
def refine_func(vertices, area): return area > max_area | def refine_func(vertices, area): return area > max_area | 445,866 |
def refine_func(vertices, area): return area > max_area | def refine_func(vertices, area): return area > max_area | 445,867 |
def make_fine_center_rect_mesh(a=(0,0), b=(1,1), boundary_tagger=(lambda fvi, el, fn, points: []), periodicity=None, inner_width=0.1, max_area=None, inner_max_area=0.02, subdivisions=None, inner_subdivisions=None, refine_func=None): """Create an unstructured rectangular mesh. @arg a: the lower left hand point of the r... | def make_fine_center_rect_mesh(a=(0,0), b=(1,1), boundary_tagger=(lambda fvi, el, fn, points: []), periodicity=None, inner_width=0.1, max_area=None, inner_max_area=0.02, subdivisions=None, inner_subdivisions=None, refine_func=None): """Create an unstructured rectangular mesh. @arg a: the lower left hand point of the r... | 445,868 |
def make_fine_center_rect_mesh(a=(0,0), b=(1,1), boundary_tagger=(lambda fvi, el, fn, points: []), periodicity=None, inner_width=0.1, max_area=None, inner_max_area=0.02, subdivisions=None, inner_subdivisions=None, refine_func=None): """Create an unstructured rectangular mesh. @arg a: the lower left hand point of the r... | def make_fine_center_rect_mesh(a=(0,0), b=(1,1), boundary_tagger=(lambda fvi, el, fn, points: []), periodicity=None, inner_width=0.1, max_area=None, inner_max_area=0.02, subdivisions=None, inner_subdivisions=None, refine_func=None): """Create an unstructured rectangular mesh. @arg a: the lower left hand point of the r... | 445,869 |
def refine_func(vertices, area): from pytools import average centroid_y = average(vertex[1] for vertex in vertices) if a[1]+fine_start_h <= centroid_y <= a[1]+fine_end_h: return area > inner_max_area else: return area > max_area | def refine_func(vertices, area): from pytools import average centroid_y = average(vertex[1] for vertex in vertices) if a[1]+fine_start_h <= centroid_y <= a[1]+fine_end_h: return area > inner_max_area else: return area > max_area | 445,870 |
def refine_func(vertices, area): from pytools import average centroid_y = average(vertex[1] for vertex in vertices) if a[1]+fine_start_h <= centroid_y <= a[1]+fine_end_h: return area > inner_max_area else: return area > max_area | def refine_func(vertices, area): from pytools import average centroid_y = average(vertex[1] for vertex in vertices) if a[1]+fine_start_h <= centroid_y <= a[1]+fine_end_h: return area > inner_max_area else: return area > max_area | 445,871 |
def make_extrusion_with_fine_core(rz, inner_r, max_volume_inner=1e-4, max_volume_outer=5e-2, radial_subdiv=20): min_z = min(rz_pt[1] for rz_pt in rz) max_z = max(rz_pt[1] for rz_pt in rz) from meshpy.tet import MeshInfo, build from meshpy.geometry import generate_surface_of_revolution MINUS_Z_MARKER = 1 PLUS_Z_MARKE... | def make_extrusion_with_fine_core(rz, inner_r, max_volume_inner=1e-4, max_volume_outer=5e-2, radial_subdiv=20): min_z = min(rz_pt[1] for rz_pt in rz) max_z = max(rz_pt[1] for rz_pt in rz) from meshpy.tet import MeshInfo, build from meshpy.geometry import generate_surface_of_revolution MINUS_Z_MARKER = 1 PLUS_Z_MARKE... | 445,872 |
def make_extrusion_with_fine_core(rz, inner_r, max_volume_inner=1e-4, max_volume_outer=5e-2, radial_subdiv=20): min_z = min(rz_pt[1] for rz_pt in rz) max_z = max(rz_pt[1] for rz_pt in rz) from meshpy.tet import MeshInfo, build from meshpy.geometry import generate_surface_of_revolution MINUS_Z_MARKER = 1 PLUS_Z_MARKE... | def make_extrusion_with_fine_core(rz, inner_r, max_volume_inner=1e-4, max_volume_outer=5e-2, radial_subdiv=20): min_z = min(rz_pt[1] for rz_pt in rz) max_z = max(rz_pt[1] for rz_pt in rz) from meshpy.tet import MeshInfo, build from meshpy.geometry import generate_surface_of_revolution MINUS_Z_MARKER = 1 PLUS_Z_MARKE... | 445,873 |
def make_extrusion_with_fine_core(rz, inner_r, max_volume_inner=1e-4, max_volume_outer=5e-2, radial_subdiv=20): min_z = min(rz_pt[1] for rz_pt in rz) max_z = max(rz_pt[1] for rz_pt in rz) from meshpy.tet import MeshInfo, build from meshpy.geometry import generate_surface_of_revolution MINUS_Z_MARKER = 1 PLUS_Z_MARKE... | def make_extrusion_with_fine_core(rz, inner_r, max_volume_inner=1e-4, max_volume_outer=5e-2, radial_subdiv=20): min_z = min(rz_pt[1] for rz_pt in rz) max_z = max(rz_pt[1] for rz_pt in rz) from meshpy.tet import MeshInfo, build from meshpy.geometry import generate_surface_of_revolution MINUS_Z_MARKER = 1 PLUS_Z_MARKE... | 445,874 |
def make_extrusion_with_fine_core(rz, inner_r, max_volume_inner=1e-4, max_volume_outer=5e-2, radial_subdiv=20): min_z = min(rz_pt[1] for rz_pt in rz) max_z = max(rz_pt[1] for rz_pt in rz) from meshpy.tet import MeshInfo, build from meshpy.geometry import generate_surface_of_revolution MINUS_Z_MARKER = 1 PLUS_Z_MARKE... | def make_extrusion_with_fine_core(rz, inner_r, max_volume_inner=1e-4, max_volume_outer=5e-2, radial_subdiv=20): min_z = min(rz_pt[1] for rz_pt in rz) max_z = max(rz_pt[1] for rz_pt in rz) from meshpy.tet import MeshInfo, build from meshpy.geometry import generate_surface_of_revolution MINUS_Z_MARKER = 1 PLUS_Z_MARKE... | 445,875 |
def make_extrusion_with_fine_core(rz, inner_r, max_volume_inner=1e-4, max_volume_outer=5e-2, radial_subdiv=20): min_z = min(rz_pt[1] for rz_pt in rz) max_z = max(rz_pt[1] for rz_pt in rz) from meshpy.tet import MeshInfo, build from meshpy.geometry import generate_surface_of_revolution MINUS_Z_MARKER = 1 PLUS_Z_MARKE... | def make_extrusion_with_fine_core(rz, inner_r, max_volume_inner=1e-4, max_volume_outer=5e-2, radial_subdiv=20): min_z = min(rz_pt[1] for rz_pt in rz) max_z = max(rz_pt[1] for rz_pt in rz) from meshpy.tet import MeshInfo, build from meshpy.geometry import generate_surface_of_revolution MINUS_Z_MARKER = 1 PLUS_Z_MARKE... | 445,876 |
def make_extrusion_with_fine_core(rz, inner_r, max_volume_inner=1e-4, max_volume_outer=5e-2, radial_subdiv=20): min_z = min(rz_pt[1] for rz_pt in rz) max_z = max(rz_pt[1] for rz_pt in rz) from meshpy.tet import MeshInfo, build from meshpy.geometry import generate_surface_of_revolution MINUS_Z_MARKER = 1 PLUS_Z_MARKE... | def make_extrusion_with_fine_core(rz, inner_r, max_volume_inner=1e-4, max_volume_outer=5e-2, radial_subdiv=20): min_z = min(rz_pt[1] for rz_pt in rz) max_z = max(rz_pt[1] for rz_pt in rz) from meshpy.tet import MeshInfo, build from meshpy.geometry import generate_surface_of_revolution MINUS_Z_MARKER = 1 PLUS_Z_MARKE... | 445,877 |
def make_extrusion_with_fine_core(rz, inner_r, max_volume_inner=1e-4, max_volume_outer=5e-2, radial_subdiv=20): min_z = min(rz_pt[1] for rz_pt in rz) max_z = max(rz_pt[1] for rz_pt in rz) from meshpy.tet import MeshInfo, build from meshpy.geometry import generate_surface_of_revolution MINUS_Z_MARKER = 1 PLUS_Z_MARKE... | def make_extrusion_with_fine_core(rz, inner_r, max_volume_inner=1e-4, max_volume_outer=5e-2, radial_subdiv=20): min_z = min(rz_pt[1] for rz_pt in rz) max_z = max(rz_pt[1] for rz_pt in rz) from meshpy.tet import MeshInfo, build from meshpy.geometry import generate_surface_of_revolution MINUS_Z_MARKER = 1 PLUS_Z_MARKE... | 445,878 |
def zper_boundary_tagger(fvi, el, fn, points): face_marker = fvi2fm[frozenset(fvi)] if face_marker == MINUS_Z_MARKER: return ["minus_z"] elif face_marker == PLUS_Z_MARKER: return ["plus_z"] else: return ["shell"] | def zper_boundary_tagger(fvi, el, fn, points): face_marker = fvi2fm[frozenset(fvi)] if face_marker == MINUS_Z_MARKER: return ["minus_z"] elif face_marker == PLUS_Z_MARKER: return ["plus_z"] else: return ["shell"] | 445,879 |
def find_pxd_file(self, qualified_name, pos): # Search include path for the .pxd file corresponding to the # given fully-qualified module name. # Will find either a dotted filename or a file in a # package directory. If a source file position is given, # the directory containing the source file is searched first #... | def find_pxd_file(self, qualified_name, pos): # Search include path for the .pxd file corresponding to the # given fully-qualified module name. # Will find either a dotted filename or a file in a # package directory. If a source file position is given, # the directory containing the source file is searched first #... | 445,880 |
def find_pyx_file(self, qualified_name, pos): # Search include path for the .pyx file corresponding to the # given fully-qualified module name, as for find_pxd_file(). return self.search_package_directories(qualified_name, pyx_suffixes, pos) | def find_pyx_file(self, qualified_name, pos): # Search include path for the .pyx file corresponding to the # given fully-qualified module name, as for find_pxd_file(). print "Pyrex.Compiler.Main.find_pyx_file:", qualified_name, pos result = self.search_package_directories(qualified_name, pyx_suffixes, pos) print "Pyr... | 445,881 |
def descend_to_package_dir(self, root_dir, package_names): # Starting from the given root directory, look for a nested # succession of package directories. Returns the full pathname # of the innermost one, or None. dir = root_dir for name in package_names: dir = os.path.join(dir, name) if self.is_package_dir(dir): r... | def descend_to_package_dir(self, root_dir, package_names): # Starting from the given root directory, look for a nested # succession of package directories. Returns the full pathname # of the innermost one, or None. dir = root_dir for name in package_names: dir = os.path.join(dir, name) if not self.is_package_dir(dir... | 445,882 |
def __init__(self, source, options): self.c_file = None self.h_file = None self.i_file = None self.api_file = None self.listing_file = None self.object_file = None self.extension_file = None cwd = os.getcwd() source = os.path.join(cwd, source) if options.use_listing_file: self.listing_file = replace_suffix(source, ".li... | def __init__(self, source, options): cwd = os.getcwd() source = os.path.join(cwd, source) if options.use_listing_file: self.listing_file = replace_suffix(source, ".lis") if options.output_file: self.c_file = os.path.join(cwd, options.output_file) else: if options.cplus: self.c_file = replace_suffix(source, cplus_suffix... | 445,883 |
def __init__(self, source, options): self.c_file = None self.h_file = None self.i_file = None self.api_file = None self.listing_file = None self.object_file = None self.extension_file = None cwd = os.getcwd() source = os.path.join(cwd, source) if options.use_listing_file: self.listing_file = replace_suffix(source, ".li... | def __init__(self, source, options): self.c_file = None self.h_file = None self.i_file = None self.api_file = None self.listing_file = None self.object_file = None self.extension_file = None cwd = os.getcwd() source = os.path.join(cwd, source) if options.use_listing_file: self.listing_file = replace_suffix(source, ".li... | 445,884 |
def compile_multiple(sources, options): """ compile_multiple(sources, options) Compiles the given sequence of Pyrex implementation files and returns a CompilationResultSet. Performs timestamp checking and/or recursion if these are specified in the options. """ sources = [os.path.abspath(source) for source in sources] ... | def compile_multiple(sources, options): """ compile_multiple(sources, options) Compiles the given sequence of Pyrex implementation files and returns a CompilationResultSet. Performs timestamp checking and/or recursion if these are specified in the options. """ sources = [os.path.abspath(source) for source in sources] ... | 445,885 |
def generate_member_table(self, env, code): #print "ModuleNode.generate_member_table: scope =", env ### if env.public_attr_entries: code.putln("") code.putln( "static struct PyMemberDef %s[] = {" % env.member_table_cname) type = env.parent_type if type.typedef_flag: objstruct = type.objstruct_cname else: objstruct = "s... | def generate_member_table(self, env, code): #print "ModuleNode.generate_member_table: scope =", env ### if env.public_attr_entries: code.putln("") code.putln( "static struct PyMemberDef %s[] = {" % env.member_table_cname) type = env.parent_type if type.typedef_flag: objstruct = type.objstruct_cname else: objstruct = "s... | 445,886 |
def compile_time_value(self, denv): attr = self.attribute if attr.beginswith("__") and attr.endswith("__"): self.error("Invalid attribute name '%s' in compile-time expression" % attr) return None obj = self.arg.compile_time_value(denv) try: return getattr(obj, attr) except Exception, e: self.compile_time_value_error(e) | def compile_time_value(self, denv): attr = self.attribute if attr.startswith("__") and attr.endswith("__"): self.error("Invalid attribute name '%s' in compile-time expression" % attr) return None obj = self.arg.compile_time_value(denv) try: return getattr(obj, attr) except Exception, e: self.compile_time_value_error(e) | 445,887 |
def assignable_from_resolved_type(self, src_type): return self.same_as(src_type) | def assignable_from_resolved_type(self, src_type): return self.same_as(src_type) or src_type is error_type | 445,888 |
def assignable_from_resolved_type(self, src_type): return src_type.is_int or src_type.is_enum or src_type is error_type | def assignable_from_resolved_type(self, src_type): return src_type.is_int or src_type.is_enum or src_type is error_type | 445,889 |
def assignable_from_resolved_type(self, src_type): return src_type.is_numeric or src_type is error_type | def assignable_from_resolved_type(self, src_type): return src_type.is_numeric or src_type is error_type | 445,890 |
def analyse_declarations(self, env): scope = None base_scopes = [] for base in self.bases: base_entry = env.find_qualified_name(base, self.pos) if base_entry: if base_entry.is_type and base_entry.type.is_struct_or_union \ and base_entry.type.scope.is_cplus: base_scopes.append(base_entry.type.scope) else: error(self.pos... | def analyse_declarations(self, env): scope = None base_scopes = [] for base in self.bases: base_entry = env.find_qualified_name(base, self.pos) if base_entry: if not base_entry.is_type: self.base_error(base, "is not a type") elif not base_entry.type.is_struct_or_union: self.base_error(base, "is not a struct") elif not ... | 445,891 |
def analyse_declarations(self, env): scope = None base_scopes = [] for base in self.bases: base_entry = env.find_qualified_name(base, self.pos) if base_entry: if base_entry.is_type and base_entry.type.is_struct_or_union \ and base_entry.type.scope.is_cplus: base_scopes.append(base_entry.type.scope) else: error(self.pos... | def analyse_declarations(self, env): scope = None base_scopes = [] for base in self.bases: base_entry = env.find_qualified_name(base, self.pos) if base_entry: if base_entry.is_type and base_entry.type.is_struct_or_union \ and base_entry.type.scope.is_cplus: base_scopes.append(base_entry.type.scope) else: base_scopes.ap... | 445,892 |
def compile_time_value(self, denv): attr = self.attribute if attr.startswith("__") and attr.endswith("__"): self.error("Invalid attribute name '%s' in compile-time expression" % attr) return None obj = self.arg.compile_time_value(denv) try: return getattr(obj, attr) except Exception, e: self.compile_time_value_error(e) | def compile_time_value(self, denv): attr = self.attribute if attr.startswith("__") and attr.endswith("__"): self.error("Invalid attribute name '%s' in compile-time expression" % attr) return None obj = self.obj.compile_time_value(denv) try: return getattr(obj, attr) except Exception, e: self.compile_time_value_error(e) | 445,893 |
def find_pxd_file(self, qualified_name, pos): # Search include path for the .pxd file corresponding to the # given fully-qualified module name. # Will find either a dotted filename or a file in a # package directory. If a source file position is given, # the directory containing the source file is searched first #... | def find_pxd_file(self, qualified_name, pos): # Search include path for the .pxd file corresponding to the # given fully-qualified module name. # Will find either a dotted filename or a file in a # package directory. If a source file position is given, # the directory containing the source file is searched first #... | 445,894 |
def find_pyx_file(self, qualified_name, pos): # Search include path for the .pyx file corresponding to the # given fully-qualified module name, as for find_pxd_file(). print "Pyrex.Compiler.Main.find_pyx_file:", qualified_name, pos ### result = self.search_package_directories(qualified_name, pyx_suffixes, pos) print ... | def find_pyx_file(self, qualified_name, pos): # Search include path for the .pyx file corresponding to the # given fully-qualified module name, as for find_pxd_file(). print "Pyrex.Compiler.Main.find_pyx_file:", qualified_name, pos ### result = self.search_package_directories(qualified_name, pyx_suffixes, pos) print ... | 445,895 |
def search_package_directories(self, qualified_name, suffixes, pos): print "Pyrex.Compiler.Main.search_package_directories:" ### print "...qualified_name =", qualified_name ### print "...suffixes =", suffixes ### print "...pos =", pos ### dotted_filenames = [qualified_name + suffix for suffix in suffixes] if pos: here ... | def search_package_directories(self, qualified_name, suffixes, pos): print "Pyrex.Compiler.Main.search_package_directories:" ### print "...qualified_name =", qualified_name ### print "...suffixes =", suffixes ### print "...pos =", pos ### dotted_filenames = [qualified_name + suffix for suffix in suffixes] if pos: here ... | 445,896 |
def search_package_directories(self, qualified_name, suffixes, pos): print "Pyrex.Compiler.Main.search_package_directories:" ### print "...qualified_name =", qualified_name ### print "...suffixes =", suffixes ### print "...pos =", pos ### dotted_filenames = [qualified_name + suffix for suffix in suffixes] if pos: here ... | def search_package_directories(self, qualified_name, suffixes, pos): print "Pyrex.Compiler.Main.search_package_directories:" ### print "...qualified_name =", qualified_name ### print "...suffixes =", suffixes ### print "...pos =", pos ### dotted_filenames = [qualified_name + suffix for suffix in suffixes] if pos: here ... | 445,897 |
def search_package_directories(self, qualified_name, suffixes, pos): print "Pyrex.Compiler.Main.search_package_directories:" ### print "...qualified_name =", qualified_name ### print "...suffixes =", suffixes ### print "...pos =", pos ### dotted_filenames = [qualified_name + suffix for suffix in suffixes] if pos: here ... | def search_package_directories(self, qualified_name, suffixes, pos): print "Pyrex.Compiler.Main.search_package_directories:" ### print "...qualified_name =", qualified_name ### print "...suffixes =", suffixes ### print "...pos =", pos ### dotted_filenames = [qualified_name + suffix for suffix in suffixes] if pos: here ... | 445,898 |
def search_package_directories(self, qualified_name, suffixes, pos): print "Pyrex.Compiler.Main.search_package_directories:" ### print "...qualified_name =", qualified_name ### print "...suffixes =", suffixes ### print "...pos =", pos ### dotted_filenames = [qualified_name + suffix for suffix in suffixes] if pos: here ... | def search_package_directories(self, qualified_name, suffixes, pos): print "Pyrex.Compiler.Main.search_package_directories:" ### print "...qualified_name =", qualified_name ### print "...suffixes =", suffixes ### print "...pos =", pos ### dotted_filenames = [qualified_name + suffix for suffix in suffixes] if pos: here ... | 445,899 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.