Categories
Mastering Development

Projecting eigenvectors for fisher’s linear discriminant analysis

I am trying to implement this feature selection method that also allows me to classify data. Following this: paper I have tried many workarounds and ways to implement this, but always my data gets weird. The public dataset that is made available has only to aquisition 1 and 4, to which i have extracted the […]

Categories
Development

Matplotlib blank space with no color when use fill_between with where option

Update: I slice days into 100 points then interpolate the corresponding value of min_temp and max_temp, the result become better, but still some area have no color, how to modify it? days_vals=numpy.linspace(1,10,100) min_interp=numpy.interp(days_vals,days,min_temp) max_interp=numpy.interp(days_vals,days,max_temp) plt.xticks(days) plt.plot(days_vals,min_interp,c=’b’,marker=’o’) plt.plot(days_vals,max_interp,c=’g’,marker=’o’) plt.fill_between(days_vals,min_interp,max_interp,where=[i>35 for i in min_interp], facecolor=’lightgreen’,alpha=0.7,interpolate=False) plt.fill_between(days_vals,min_interp,max_interp,where=[i<=35 for i in min_interp], facecolor=’lightpink’,alpha=0.7,interpolate=False) I am using fill_between with where […]

Categories
Development

Creating polygons from linestrings that has some duplicate line?

below code shows how input data look like. #!/usr/bin/python import matplotlib.pyplot as plt from shapely.geometry import MultiLineString from math import sqrt import random GM = (sqrt(5)-1.0)/2.0 W = 8.0 H = W*GM SIZE = (W, H) dim = (1400,2500) def plot_data(lines,center): fig = plt.figure(1, figsize=SIZE, dpi=90) ax = fig.add_subplot(121) mline1 = MultiLineString(lines) plot_coords(ax, mline1) plot_lines(ax, […]

Categories
Development

How to convert vector points to lines following a specific order -python

I am working with a set of points that represent the different stops of a bus line. I have a .csv file that give the stop_id, lon, lat, stop_sequence (which determines the ordre of the stops along the bus line) and the direction_id (which is either 1 or 0 and represents the direction taken by […]

Categories
Development

For loop to create multiple histogram png files

I am not sure as to why this happens. Maybe it is just a simple mistake that I cannot see, but by using this code: for filename in glob.glob(‘/Users/jacob/Desktop/MERS/new/NOT COAL/gensets/statistics_per_lgu/per_lgu_files/*.csv’): base = os.path.basename(filename) name = os.path.splitext(base)[0] df = pd.read_csv(filename) # Show 4 different binwidths for i, binwidth in enumerate([10, 20, 30, 40]): # Set up […]