-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRandomsRanges.py
52 lines (45 loc) · 1.51 KB
/
RandomsRanges.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/local/sci/bin/python
#***************************************
# LetterRange: Range of characters
#
#
#
# 03 April 2014 KMW - v1
#************************************************************************
# START
#************************************************************************
# USE python2.7
#************************************************************************
# Set up python imports
import numpy as np
import matplotlib.pyplot as plt
import sys, os
from scipy.optimize import curve_fit,fsolve,leastsq
from scipy import pi,sqrt,exp
from scipy.special import erf
import scipy.stats
from math import sqrt,pi
import struct
#************************************************************************
# Subroutines
#************************************************************************
# LetterRange
def LetterRange(start,stop):
''' provide either a start and end number corresponding to A-Z '''
''' or an 'a' to 'z' character '''
''' code returns an array of letters '''
''' a=97 so start+97 '''
if isinstance(start,int):
newstart=start+97
newstop=stop+97
# print('Integers: ',newstart,newstop)
else:
newstart=ord(start)
newstop=ord(stop)
# print('Characters: ',newstart,newstop)
Alphabetti=[]
for char in xrange(newstart,newstop):
# print(chr(char))
Alphabetti.append(chr(char))
return Alphabetti # LetterRange
#************************************************************************