Git Product home page Git Product logo

python_scripting_cms's People

Contributors

abbycabs avatar alee avatar anacost avatar armcdona avatar brandoncurtis avatar erinbecker avatar evanwill avatar fmichonneau avatar gvwilson avatar ianlee1521 avatar janash avatar jduckles avatar jpallen avatar jsta avatar katrinleinweber avatar khoivan88 avatar mawds avatar maxim-belkin avatar mr-c avatar neon-ninja avatar pbanaszkiewicz avatar pipitone avatar raynamharris avatar rgaiacs avatar synesthesiam avatar tracykteal avatar trk9001 avatar twitwi avatar vincehradil avatar wclose avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

python_scripting_cms's Issues

Introduce `elif` concept

Hi, thank you for the tutorial. I just have a suggestion on the use of elif clause instead of just if clause in this block:
https://github.com/MolSSI-Education/python_scripting_cms/edit/gh-pages/_episodes/02-file_parsing.md#L256-L268

...
for line in saptlines:
    if 'Electrostatics    ' in line:
        electro_line = line
        important_lines.append(electro_line)
    if 'Exchange       ' in line:
        exchange_line = line
        important_lines.append(exchange_line)
    if 'Induction      ' in line:
        induction_line = line
        important_lines.append(induction_line)
    if 'Dispersion     ' in line:
        dispersion_line = line
        important_lines.append(dispersion_line)
...

Functions lesson

I think we may want to decouple the functions lesson from the geometry analysis project. It is extremely unlikely that students will have completed this project by the time we reach this lesson, and we don't want to confuse them with too much code. Decoupling this would be very easy, and we can add the geometry analysis part of the lesson at the end.

Strategy for getting files in episode 3

In the current lesson (03-multiple_files), we are using the glob module. However, in Python 3.4 and above, there is another strategy that is arguably a "better practice". The pathlib library can be used in Python 3.4 and above. It has a glob function, and can also be used to manipulate file paths.

In this case, instead of this code block:

import glob
filenames = glob.glob('outfiles/*.out')
print(filenames)

We would have

import pathlib
current_dir = Path('.', 'outfiles')
filenames = current_dir.glob('*.out')
print(list(filenames))

This addresses a second issue with the current code. The line filenames = glob.glob('outfiles/*.out') is not compatible with Windows because of the / character (Windows uses a \). Before the filepath library, this would have been fixed using os.path. However, the code block using pathlib should fix this issue.

We may consider having a section on working with file paths, as I imagine that many of the attendees will use Windows. It is also very common for people to hard code in file paths, when this can lead to problems later.

Read more here:
http://blog.danwin.com/using-python-3-pathlib-for-managing-filenames-and-directories/

benzene.xyz file

The lesson on functions contains an example with a benzene.xyz file, however I never added this to the repository. We should skip this example for now, but add for later workshops. For SETCA, we could consider having it as a gist

Introduction Lesson

Here are some suggested improvements from the introduction lesson, based on me working through it (May 2, 2019)

  • Need to emphasize that when slicing a list, the first element is included, but the last is not. ie energy_kcal[0:2] accesses element 0 up to (but not including) 2.

  • Emphasize immutability when demonstrating that you can multiply particular elements of a list (conversion to kJ from kcal example)

  • Include exercise on grabbing a particular element of a list.

  • Emphasize importance of colon in for loop. Perhaps add exercise where colon is not included with error message to get students to figure out what is wrong.

  • "If you are comparing strings, not numbers, you use different logic operators like is, in, or is not. We will see these types of logic operators used in our next lesson."
    ^This isn't quite correct. We still use == with strings. In Python, is is used to check if things are the same object, while == is used to check if objects have the same value.

  • The exercise at the end of the lesson then uses is to check data types. We need to think about this with the explanation of is, etc

Working with tabular data exercise

Exercise: "Calculate the average of each row of data. You don’t want to include the frame numbers in the average. Make a new list of the average of each row."

I think discarding the frame numbers in the exercise might be confusing for those following along. Since it's in an exercise, I can see it being something people might miss, as they might make new data instead of overwriting the variable, or skip the first column in another way.

For example, this was my solution:

avg_list = []

for row in data:
    avg_list.append(np.mean(row[1:]))

Here, I haven't discarded the frame numbers, so the following code block is different for me.

Tabular data and plotting lesson

I think we should extend analysis with tabular data - perhaps show them other functions like max and min and move plotting to its own lesson. There is a lot more we can show them in plotting. I'll be doing a PR soon that fleshes out options for plotting. However, we could show them types of plots besides line plots (scatter, bar, etc).

Plotting lesson

The variables in the plotting lesson need to be updated for consistency with the other lessons

Common `import` short cut names

Currently in the lessons when we import numpy and matplotlib, we are using the full names. I think it gets pretty cumbersome to type matplotlib.pyplot every time we want to use this library. We can introduce common abbreviations for imports such as

import numpy as np

import matplotlib.pyplot as plt

This way, they are typing plt.xlabel('Simluation Frame') instead of matplotlib.pyplot.xlabel('Simluation Frame'), for example.

Distances data in episode 4

In episode 4 ("Working with Tabular Data"), they work with a preprocessed distances file.

I think we should consider showing images/information about the data. For example, it might give them better context if we show them the trajectory and what the measurements are in VMD. Then they can directly see how this would relate to their research instead of just working with numbers.

We could also include in another link directions for generating the data themselves (not something we would go over in the workshop).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.