Skip to content

Instantly share code, notes, and snippets.

@understar
understar / pca
Created February 16, 2014 08:57
PCA python
# -*- coding: utf-8 -*-
from numpy import mean,cov,double,cumsum,dot,linalg,array,rank
from pylab import plot,subplot,axis,stem,show,figure
def princomp(A):
""" performs principal components analysis
(PCA) on the n-by-p data matrix A
Rows of A correspond to observations, columns to variables.
Returns :
@understar
understar / kernel_pca
Created February 16, 2014 08:59
Kernel PCA
"""
==========
Kernel PCA
==========
This example shows that Kernel PCA is able to find a projection of the data
that makes data linearly separable.
"""
print(__doc__)
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
struct xyz
{
float x, y, z;
using System;
using System.Net;
using System.IO;
using Gdk;
namespace TileSticher
{
class App
{
public static int Main (string[] args)
#include <io.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <windows.h>
#include <Share.h>
#include <math.h>
@understar
understar / tmscatch
Last active August 29, 2015 14:04
Download tiles from TIANDITU_SICHUAN
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 23 10:41:47 2014
@author: shuaiyi
"""
import logging
from landez import TilesManager
down = False
@understar
understar / png2tiff.py
Created July 24, 2014 14:00
GDAL project TIANDITUSICHUAN tile png to wgs84 geotiff
import gdal, osr
import numpy as np
levelsdetail = {18:(262144, 131072, 256),
17:(131072, 65536, 256)
}
def lat_lon2index(lat, lon, level): # top left corner
width = levelsdetail[level][0]
height = levelsdetail[level][1]

Basic example of taking an output from our server and putting it on a map. As leaflet allows you to add geoJSON directly, we convert it from esri's JSON format to a more standard one.

@understar
understar / 420show.py
Last active August 29, 2015 14:04
plot picture scatter
# -*- coding: cp936-*-
__author__ = 'shuaiyi'
import logging
import numpy as np
import calc_tsne as tsne
import matplotlib.pyplot as plt
from features import dataset as ds
logging.getLogger().setLevel(logging.INFO)
@understar
understar / star.md
Last active August 29, 2015 14:05
资源收藏记录