This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Calculate mean std of clipped array""" | |
import numpy as np | |
from scipy import interpolate | |
def calc_func_clipped(X, Y, func=np.mean, npoints=None, verbose=False): | |
""" Calculates func of Y values, where Y is clipped to the longest continuous | |
values of X to prevent aliasing | |
""" | |
# Size of each data vector |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def expand_time(time, shape, verbose=True): | |
if verbose: | |
print 'Old time shape:',time.shape,'new shape:',shape | |
output = np.tile(time, shape[1]).reshape(np.fliplr([shape])[0]).T | |
if verbose: | |
print 'output time shape:',output.shape | |
return output |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rant = data['r'][0][0] | |
zant = data['z'][0][0] | |
sep_z = data['sep_z'] | |
sep_r = data['sep_r'] | |
sep_ra = np.linalg.norm(np.array([sep_r-rant,sep_z-zant]),axis=0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%%%%%%%%%%%%%%%% | |
% This is altacv.cls (v1.1.3, 30 April 2017) written by | |
% LianTze Lim ([email protected]). | |
% | |
%% It may be distributed and/or modified under the | |
%% conditions of the LaTeX Project Public License, either version 1.3 | |
%% of this license or (at your option) any later version. | |
%% The latest version of this license is in | |
%% http://www.latex-project.org/lppl.txt | |
%% and version 1.3 or later is part of all distributions of LaTeX |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from mpl_toolkits.mplot3d import axes3d | |
import matplotlib | |
matplotlib.use("Agg") | |
import matplotlib.pyplot as plt | |
import matplotlib.animation as animation | |
import matplotlib.colors as colors |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
typedef enum { | |
NORTH = 0, | |
EAST = 1, | |
SOUTH = 2, | |
WEST = 3 | |
} directionValues; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reducing sample names of QN61 by 1 value to match QN62, QN63 and the DieMap | |
root_dir = os.path.abspath(path_string) | |
files = os.listdir(root_dir) | |
prefix = ".csv" | |
files = [file for file in files if prefix in file] | |
for file in files: | |
number = int(file[1:4])-1 | |
# print("%03d"%number) | |
newfile = "S%03d.csv"%number |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from PIL import Image | |
def save_array_as_image(array, filename): | |
"""Saves a 2D numpy array to an image""" | |
image = Image.fromarray(array) | |
image.save(filename) | |
array = np.random.random((512,512))*255 | |
array = np.uint8(array) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def convert_array_to_levels(array, levels, limits=[-np.pi,np.pi], output_limits=None, verbose=False): | |
"""Dgitizes the given array to within the number of levels provided | |
Parameters | |
---------- | |
array : input array of values | |
levels : number of levels to consider | |
limits : the input data limits to consider for the interval calculation | |
output_limits : if given, multiplies the digitized input to the output range | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def remove_extension(filename, separator="."): | |
return separator.join(filename.split(separator)[:-1]) |