Redefinition of columns to add the information that a column is geometric
761229
def columns(table_name, name = nil)#:nodoc:
      show_fields_from(table_name, name).map do |field|
        klass = \
          if field[1] =~ GEOMETRY_REGEXP
            ActiveRecord::ConnectionAdapters::SpatialMysql2Column
          else
            ActiveRecord::ConnectionAdapters::Mysql2Column
          end
        klass.new(field[0], field[4], field[1], field[2] == "YES")
      end
    end
630574
def set_columns(self, columns):
        """"""
        if isinstance(columns, tuple):
            self.columns = columns
        elif is_text_string(columns):
            self.columns = tuple(int(e) for e in columns.split(','))

        self.update()
1217251
def column(self, col):
        
        if type(col) is str:
            for c in self._cols:
                if c.name == col:
                    return c
        else:
            return self._cols[col]
294858
private Geometry simplify(Geometry geom, double resolution, double factor){
		Geometry simplifiedGeometry = null;
		
		if( geom instanceof GeometryCollection ){
			GeometryCollection collection = (GeometryCollection)geom;
			boolean isSimplified = false;
			//List<Geometry> newComponents = new Vector<Geometry>();
			
			// Extract basic geometries
			List<Geometry> basicGeometries = new Vector<Geometry>();
			collection.accumulateBasicGeometries(basicGeometries);
			
			List<Point> accumulatedPoints = new Vector<Point>();
			List<LineString> accumulatedLineStrings = new Vector<LineString>();
			List<Polygon> accumulatedPolygons = new Vector<Polygon>();
			
			for(Geometry component : basicGeometries){
				if( component instanceof Point ){
					Point p = (Point)component;
					accumulatedPoints.add(p);
				
				} else if( component instanceof LineString ){
					LineString ls = (LineString)component;
					accumulatedLineStrings.add(ls);
					
				} else if( component instanceof Polygon ){
					Polygon poly = (Polygon)component;
					accumulatedPolygons.add(poly);
				}
			}
			
			List<Geometry> newComponents = new Vector<Geometry>();

			// Deal with polygons in one simplification
			if( accumulatedPolygons.size() > 0 ){
				MultiPolygon polygons = new MultiPolygon(accumulatedPolygons);
				Geometry effectiveComponent = simplify(polygons, resolution, factor);
				if( null != effectiveComponent ){
					isSimplified = true;
					newComponents.add(effectiveComponent);
				} else {
					newComponents.add(polygons);
				}
			}

			// Deal with linestrings in one simplification
			if( accumulatedLineStrings.size() > 0 ){
				MultiLineString linestrings = new MultiLineString(accumulatedLineStrings);
				Geometry effectiveComponent = simplify(linestrings, resolution, factor);
				if( null != effectiveComponent ){
					isSimplified = true;
					newComponents.add(effectiveComponent);
				} else {
					newComponents.add(linestrings);
				}
			}

			// Deal with points in one simplification
			if( accumulatedPoints.size() > 0 ){
				MultiPoint points = new MultiPoint(accumulatedPoints);
				Geometry effectiveComponent = simplify(points, resolution, factor);
				if( null != effectiveComponent ){
					isSimplified = true;
					newComponents.add(effectiveComponent);
				} else {
					newComponents.add(points);
				}
			}
			
			if( isSimplified ){
				simplifiedGeometry = new GeometryCollection(newComponents);
			}
			
		} else if( geom instanceof Point ) {
//			Point point = (Point)geom;
//			
//			double x = Math.round(point.getX() * factor) / factor;
//			double y = Math.round(point.getY() * factor) / factor;
//			if( x != point.getX() 
//			 || y != point.getY() ){
//				simplifiedGeometry = new Point(x,y);
//			}
			
		} else if( geom instanceof LineString ) {
			// The simplification of a LineString might result into a LineString
			// or into a point
			LineString lineString = (LineString)geom;
			boolean isGeneralized = false;
			List<Point> accumulatedPoints = new Vector<Point>();
			Point lastPoint = null;
			
			// Keep track of bounds
			BoundingBox bbox = new BoundingBox();
			
			for(Point point : lineString.getPoints()){
				// Keep track of bounds
				bbox.extendToInclude(point);
				
				Geometry simplifiedPointObj = simplify(point, resolution, factor);
				
				Point simplifiedPoint = null;
				if( null != simplifiedPointObj ){
					isGeneralized = true;
					simplifiedPoint = (Point)simplifiedPointObj;
				} else {
					simplifiedPoint = point;
				}
				
				if( null == lastPoint ){
					lastPoint = simplifiedPoint;
					accumulatedPoints.add(simplifiedPoint);
				} else {
					if( areLocationsColliding(simplifiedPoint, lastPoint, resolution) ){
						isGeneralized = true;
					} else {
						lastPoint = simplifiedPoint;
						accumulatedPoints.add(simplifiedPoint);
					}
				}
			}

			if( isGeneralized ){
				// A change occurred
				if( accumulatedPoints.size() < 2 ){
					// Create a point that represents the centre of the line string
					simplifiedGeometry = bbox.getCentroid();
				} else {
					simplifiedGeometry = new LineString(accumulatedPoints);
				};
			};
			
		} else if( geom instanceof Polygon ) {
			// Might return a polygon or a point
			Polygon polygon = (Polygon)geom;
			boolean newPolygonNeeded = false;
			List<LineString> newRings = new Vector<LineString>();
			
			// First linear ring is the outer limit of polygon
			List<LineString> rings = polygon.getLinearRings();
			LineString firstRing = rings.get(0);
			Geometry simplifiedFirstRing = simplify(firstRing, resolution, factor);
			if( null != simplifiedFirstRing ){
				if( simplifiedFirstRing instanceof Point ){
					// The outer ring was turned into a point. The whole
					// polygon is now a point. Do not process the other rings.
					// Abort and return the point.
					return simplifiedFirstRing;
				} else {
					newPolygonNeeded = true;
					LineString simplifiedLineString = (LineString)simplifiedFirstRing;
					newRings.add(simplifiedLineString);
				}
			} else {
				newRings.add(firstRing);
			}
			
			// The following rings are subtractions from the outer ring
			for(int i=1,e=rings.size(); i<e; ++i){
				LineString innerRing = rings.get(i);
				
				Geometry simplifiedInnerRing = simplify(innerRing,resolution,factor);
				if( null != simplifiedInnerRing ){
					newPolygonNeeded = true;
					if( simplifiedInnerRing instanceof Point ){
						// Drop inner ring
					} else {
						LineString simplifiedLineString = (LineString)simplifiedInnerRing;
						newRings.add(simplifiedLineString);
					}
				} else {
					newRings.add(innerRing);
				}
			}
			
			if( newPolygonNeeded ){
				simplifiedGeometry = new Polygon(newRings);
			}
			
		} else if( geom instanceof MultiPoint ) {
			// A MultiPoint can be simplified into a MultiPoint or
			// a simple Point
			MultiPoint multiPoint = (MultiPoint)geom;
			boolean isGeneralized = false;
			List<Point> accumulatedPoints = new Vector<Point>();
			Point lastPoint = null;
			
			for(Point point : multiPoint.getPoints()){
				Point effectivePoint = point;
				Geometry simplifiedPoint = simplify(point,resolution,factor);
				if( null != simplifiedPoint ){
					isGeneralized = true;
					effectivePoint = (Point)simplifiedPoint;
				}
				
				if( null == lastPoint ) {
					lastPoint = effectivePoint;
					accumulatedPoints.add(effectivePoint);
				} else {
					if( areLocationsColliding(effectivePoint, accumulatedPoints, resolution) ){
						// If this points is colliding with other points, do not
						// add to resulting collection
						isGeneralized = true;
					} else {
						lastPoint = effectivePoint;
						accumulatedPoints.add(effectivePoint);
					}
				}
			}
			
			if( isGeneralized ){
				if( accumulatedPoints.size() < 2 ){
					simplifiedGeometry = accumulatedPoints.get(0);
				} else {
					simplifiedGeometry = new MultiPoint(accumulatedPoints);
				}
			}
			
		} else if( geom instanceof MultiLineString ) {
			// A MultiLineString can be simplified into a MultiLineString, a LineString,
			// a MultiPoint or a Point
			MultiLineString multiLineString = (MultiLineString)geom;
			
			List<LineString> effectiveLineStrings = makeLineStrings(
					multiLineString.getLineStrings(), 
					null, 
					resolution
					);
			
			boolean isGeneralized = false;
			List<LineString> accumulatedLineStrings = new Vector<LineString>();
			List<Point> accumulatedPoints = new Vector<Point>();
			for(LineString lineString : effectiveLineStrings){
				Geometry simplifiedLineString = simplify(lineString, resolution, factor);
				if( null != simplifiedLineString ){
					isGeneralized = true;
					if( simplifiedLineString instanceof Point ){
						Point simplifiedPoint = (Point)simplifiedLineString;
						if( false == areLocationsColliding(simplifiedPoint, accumulatedPoints, resolution) ){
							accumulatedPoints.add(simplifiedPoint);
						}
					} else {
						LineString simplifiedLS = (LineString)simplifiedLineString;
						accumulatedLineStrings.add(simplifiedLS);
					}
				} else {
					accumulatedLineStrings.add(lineString);
				}
			}
			
			if( isGeneralized ){
				if( accumulatedLineStrings.size() > 1 ){
					simplifiedGeometry = new MultiLineString(accumulatedLineStrings);
					
				} else if( accumulatedLineStrings.size() == 1 ){
					simplifiedGeometry = accumulatedLineStrings.get(0);
					
				} else if( accumulatedPoints.size() > 1 ){
					simplifiedGeometry = new MultiPoint(accumulatedPoints);
					
				} else if( accumulatedPoints.size() == 1 ){
					simplifiedGeometry = accumulatedPoints.get(0);
				}
			}
			
		} else if( geom instanceof MultiPolygon ) {
			// A MultiPolygon can be simplified into a MultiPolygon, a Polygon,
			// a MultiPoint or a Point
			MultiPolygon multiPolygon = (MultiPolygon)geom;
			boolean isGeneralized = false;
			List<Polygon> accumulatedPolygons = new Vector<Polygon>();
			List<Point> accumulatedPoints = new Vector<Point>();
			for(Polygon polygon : multiPolygon.getPolygons()){
				Geometry simplifiedPolygon = simplify(polygon, resolution, factor);
				if( null != simplifiedPolygon ){
					isGeneralized = true;
					if( simplifiedPolygon instanceof Point ){
						Point simplifiedPoint = (Point)simplifiedPolygon;
						if( false == areLocationsColliding(simplifiedPoint, accumulatedPoints, resolution) ){
							accumulatedPoints.add(simplifiedPoint);
						}
					} else {
						Polygon simplifiedPoly = (Polygon)simplifiedPolygon;
						accumulatedPolygons.add(simplifiedPoly);
					}
				} else {
					accumulatedPolygons.add(polygon);
				}
			}
			
			if( isGeneralized ){
				if( accumulatedPolygons.size() > 1 ){
					simplifiedGeometry = new MultiPolygon(accumulatedPolygons);
					
				} else if( accumulatedPolygons.size() == 1 ){
					simplifiedGeometry = accumulatedPolygons.get(0);
					
				} else if( accumulatedPoints.size() > 1 ){
					simplifiedGeometry = new MultiPoint(accumulatedPoints);
					
				} else if( accumulatedPoints.size() == 1 ){
					simplifiedGeometry = accumulatedPoints.get(0);
				}
			}
		}
		
		return simplifiedGeometry;
	}
574716
def _shape(self, df):
        

        row, col = df.shape
        return row + df.columns.nlevels, col + df.index.nlevels
127842
function columnize(target) {
    var columns = typeof target === 'string' ? [target] : target;
    var str = '',
        i = -1;
    while (++i < columns.length) {
      if (i > 0) {
        str += ', ';
      }
      str += this.wrap(columns[i]);
    }
    return str;
  }
234887
def get_column_flat(self, field, components=None, computed_type='for_observations'):
        
        return self.pack_column_flat(self.get_column(field, components, computed_type),
                                     components,
                                     offset=field=='triangles')
1240835
function(table, feature, i){
    if (feature.geometry && feature.geometry.coordinates && feature.geometry.coordinates.length ){
      feature.geometry.crs = {"type":"name","properties":{"name":"EPSG:4326"}};
      //return 'insert into "'+table+'" (feature, geom) VALUES (\''+JSON.stringify(feature).replace(/'/g, "")+'\', ST_GeomFromGeoJSON(\''+JSON.stringify(feature.geometry)+'\'));' ;
      return 'insert into "'+table+'" (feature) VALUES (\''+JSON.stringify(feature).replace(/'/g, "")+'\');' ;
    } else {
      return 'insert into "'+table+'" (feature) VALUES (\''+JSON.stringify(feature).replace(/'/g, "")+'\');' ;
    }
  }
4242
def column_vectors(self):
        """"""
        a, b, c, d, e, f, _, _, _ = self
        return (a, d), (b, e), (c, f)
221102
def add_transform_columns(self):
        
        for col in ["parval1","parlbnd","parubnd","increment"]:
            if col not in self.parameter_data.columns:
                continue
            self.parameter_data.loc[:,col+"_trans"] = (self.parameter_data.loc[:,col] *
                                                          self.parameter_data.scale) +\
                                                         self.parameter_data.offset
            #isnotfixed = self.parameter_data.partrans != "fixed"
            islog = self.parameter_data.partrans == "log"
            self.parameter_data.loc[islog,col+"_trans"] = \
                self.parameter_data.loc[islog,col+"_trans"].\
                    apply(lambda x:np.log10(x))
645857
public void addGeometry(Geometry geometry) {
    if (geometry instanceof LineString) {
      addLineString(originalSegments, (LineString) geometry);
    } else if (geometry instanceof Polygon) {
      addPolygon(originalSegments, (Polygon) geometry);
    } else if (geometry instanceof GeometryCollection) {
      addGeometry(originalSegments, (GeometryCollection) geometry);
    }
  }
1003416
function columns(column) {
    if (!column) {
      return this;
    }
    this._statements.push({
      grouping: 'columns',
      value: normalizeArr.apply(null, arguments)
    });
    return this;
  }
413208
def combineColumns(cols):
    ''
    return Column("+".join(c.name for c in cols),
                  getter=lambda col,row,cols=cols,ch=' ': ch.join(c.getDisplayValue(row) for c in cols))
281326
def _make_info(shape_list, num_classes):
  """"""
  feature_info = collections.namedtuple("FeatureInfo", ["shape", "num_classes"])
  cur_shape = list(shape_list[0])
  # We need to merge the provided shapes, put None where they disagree.
  for shape in shape_list:
    if len(shape) != len(cur_shape):
      raise ValueError("Shapes need to have the same number of dimensions.")
    for i in range(len(shape)):
      if cur_shape[i] is not None:
        if shape[i] != cur_shape[i]:
          cur_shape[i] = None
  return feature_info(cur_shape, num_classes)
671251
def geometry(AA):
    ''''''
    if(AA=='G'):
        return GlyGeo()
    elif(AA=='A'):
        return AlaGeo()
    elif(AA=='S'):
        return SerGeo()
    elif(AA=='C'):
        return CysGeo()
    elif(AA=='V'):
        return ValGeo()
    elif(AA=='I'):
        return IleGeo()
    elif(AA=='L'):
        return LeuGeo()
    elif(AA=='T'):
        return ThrGeo()
    elif(AA=='R'):
        return ArgGeo()
    elif(AA=='K'):
        return LysGeo()
    elif(AA=='D'):
        return AspGeo()
    elif(AA=='E'):
        return GluGeo()
    elif(AA=='N'):
        return AsnGeo()
    elif(AA=='Q'):
        return GlnGeo()
    elif(AA=='M'):
        return MetGeo()
    elif(AA=='H'):
        return HisGeo()
    elif(AA=='P'):
        return ProGeo()
    elif(AA=='F'):
        return PheGeo()
    elif(AA=='Y'):
        return TyrGeo()
    elif(AA=='W'):
        return TrpGeo()
    else:
        return GlyGeo()
1085926
private void organizeColumns()
    {
        columns = new Vector<TableColumn>();
        for (int bi = 0; bi < nested.size(); bi++)
        {
            Box box = nested.elementAt(bi);
            if (box instanceof TableColumn)
            {
                TableColumn col = (TableColumn) box;
                if (col.getSpecifiedWidth().equals(""))
                    col.setSpecifiedWidth(colwidth); //when column width is not set, use the group width
                for (int i = 0; i < col.getSpan(); i++)
                {
                    if (i == 0)
                        columns.add(col);
                    else
                        columns.add(col.copyBox());
                }
            }
        }
        //when there are no <col> elements, use the span attribute
        if (columns.isEmpty())
        {
            TableColumn col = new TableColumn(TableColumn.createAnonymousColumn(getParent().getElement().getOwnerDocument()), g, ctx);
            col.setSpecifiedWidth(colwidth);
            for (int i = 0; i < span; i++)
                columns.add(col.copyBox());
        }
    }
1006691
def rename(**kwargs):
  
  def rename_columns(df):
    column_assignments = {old_name_later._name: new_name
                          for new_name, old_name_later in kwargs.items()}
    return df.rename(columns=column_assignments)
  return rename_columns