Phil 3.15.17

7:00 – 8:00 Research

8:30 – 5:00 BRC

  • Heath was able to upgrade to Python 3.5.2
    • Ran array_thoughts. Numbers are better than my laptop
    • Attempting just_dbscan: Some hiccups due to compiling from sources. (No module named _bz7). Stalled? Sent many links.
    • Success! Heath installed a binary Python rather than compiling from sources. A little faster than my laptop. No GPUs, CPU, not memory bound.
  • Continuing my tour of the SciPy Lecture Notes
  • Figuring out what a matplotlib backend is
  • Looks like there are multiple ways to serve graphics: http://matplotlib.org/faq/howto_faq.html#howto-webapp
  • More on typing Python
  • Class creation, inheritance and superclass overloading, with type hints:
    class Student(object):
        name = 'noName'
        age = -1
        major = 'unset'
    
        def __init__(self, name: str):
            self.name = name
    
        def set_age(self, age: int):
            self.age = age
    
        def set_major(self, major: str):
            self.major = major
    
        def to_string(self) -> str:
            return "name = {0}\nage = {1}\nmajor = {2}"\
                .format(self.name, self.age, self.major)
    
    
    class MasterStudent(Student):
        internship = 'mandatory, from March to June'
    
        def to_string(self) -> str:
            return "{0}\ninternship = {1}"\
                .format(Student.to_string(self), self.internship)
    
    
    anna = MasterStudent('anna')
    print(anna.to_string())
  • Finished the Python part, Numpy next
  • Figured out how to to get a matrix shape, (again, with type hints):
    import numpy as np
    
    
    def set_array_sequence(mat: np.ndarray):
        for i in range(mat.shape[0]):
            for j in range(mat.shape[1]):
                mat[i, j] = i * 10 + j
    
    
    a = np.zeros([10, 3])
    set_array_sequence(a)
    print(a.shape)
    print(a)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: