Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file removed Examples/BasicExamples_v3.pdf
Binary file not shown.
Binary file removed Examples/Instructions_v2.pdf
Binary file not shown.
Binary file removed Examples/SampleMovies/Lab_Original.mp4
Binary file not shown.
Binary file removed Examples/SampleMovies/Synthetic2_DigiPyRo-ed.avi
Binary file not shown.
Binary file removed Examples/SampleMovies/Synthetic2_DigiPyRo-ed_Alt.avi
Binary file not shown.
Binary file not shown.
Binary file removed Examples/SampleMovies/Synthetic2_Original.avi
Binary file not shown.
Binary file removed Examples/SampleMovies/Synthetic2_Original_Alt.avi
Binary file not shown.
Binary file removed Examples/SampleMovies/Synthetic2_Original_Rot.avi
Binary file not shown.
Binary file removed Examples/SampleMovies/Synthetic_DigiPyRo-ed_Alt.avi
Binary file not shown.
Binary file removed Examples/SampleMovies/Synthetic_Original_Alt.avi
Binary file not shown.
191 changes: 191 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction, and
distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by the copyright
owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all other entities
that control, are controlled by, or are under common control with that entity.
For the purposes of this definition, "control" means (i) the power, direct or
indirect, to cause the direction or management of such entity, whether by
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity exercising
permissions granted by this License.

"Source" form shall mean the preferred form for making modifications, including
but not limited to software source code, documentation source, and configuration
files.

"Object" form shall mean any form resulting from mechanical transformation or
translation of a Source form, including but not limited to compiled object code,
generated documentation, and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or Object form, made
available under the License, as indicated by a copyright notice that is included
in or attached to the work (an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object form, that
is based on (or derived from) the Work and for which the editorial revisions,
annotations, elaborations, or other modifications represent, as a whole, an
original work of authorship. For the purposes of this License, Derivative Works
shall not include works that remain separable from, or merely link (or bind by
name) to the interfaces of, the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including the original version
of the Work and any modifications or additions to that Work or Derivative Works
thereof, that is intentionally submitted to Licensor for inclusion in the Work
by the copyright owner or by an individual or Legal Entity authorized to submit
on behalf of the copyright owner. For the purposes of this definition,
"submitted" means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems, and
issue tracking systems that are managed by, or on behalf of, the Licensor for
the purpose of discussing and improving the Work, but excluding communication
that is conspicuously marked or otherwise designated in writing by the copyright
owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
of whom a Contribution has been received by Licensor and subsequently
incorporated within the Work.

2. Grant of Copyright License.

Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the Work and such
Derivative Works in Source or Object form.

3. Grant of Patent License.

Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable (except as stated in this section) patent license to make, have
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
such license applies only to those patent claims licensable by such Contributor
that are necessarily infringed by their Contribution(s) alone or by combination
of their Contribution(s) with the Work to which such Contribution(s) was
submitted. If You institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
Contribution incorporated within the Work constitutes direct or contributory
patent infringement, then any patent licenses granted to You under this License
for that Work shall terminate as of the date such litigation is filed.

4. Redistribution.

You may reproduce and distribute copies of the Work or Derivative Works thereof
in any medium, with or without modifications, and in Source or Object form,
provided that You meet the following conditions:

You must give any other recipients of the Work or Derivative Works a copy of
this License; and
You must cause any modified files to carry prominent notices stating that You
changed the files; and
You must retain, in the Source form of any Derivative Works that You distribute,
all copyright, patent, trademark, and attribution notices from the Source form
of the Work, excluding those notices that do not pertain to any part of the
Derivative Works; and
If the Work includes a "NOTICE" text file as part of its distribution, then any
Derivative Works that You distribute must include a readable copy of the
attribution notices contained within such NOTICE file, excluding those notices
that do not pertain to any part of the Derivative Works, in at least one of the
following places: within a NOTICE text file distributed as part of the
Derivative Works; within the Source form or documentation, if provided along
with the Derivative Works; or, within a display generated by the Derivative
Works, if and wherever such third-party notices normally appear. The contents of
the NOTICE file are for informational purposes only and do not modify the
License. You may add Your own attribution notices within Derivative Works that
You distribute, alongside or as an addendum to the NOTICE text from the Work,
provided that such additional attribution notices cannot be construed as
modifying the License.
You may add Your own copyright statement to Your modifications and may provide
additional or different license terms and conditions for use, reproduction, or
distribution of Your modifications, or for any such Derivative Works as a whole,
provided Your use, reproduction, and distribution of the Work otherwise complies
with the conditions stated in this License.

5. Submission of Contributions.

Unless You explicitly state otherwise, any Contribution intentionally submitted
for inclusion in the Work by You to the Licensor shall be under the terms and
conditions of this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify the terms of
any separate license agreement you may have executed with Licensor regarding
such Contributions.

6. Trademarks.

This License does not grant permission to use the trade names, trademarks,
service marks, or product names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the NOTICE file.

7. Disclaimer of Warranty.

Unless required by applicable law or agreed to in writing, Licensor provides the
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
including, without limitation, any warranties or conditions of TITLE,
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
solely responsible for determining the appropriateness of using or
redistributing the Work and assume any risks associated with Your exercise of
permissions under this License.

8. Limitation of Liability.

In no event and under no legal theory, whether in tort (including negligence),
contract, or otherwise, unless required by applicable law (such as deliberate
and grossly negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special, incidental,
or consequential damages of any character arising as a result of this License or
out of the use or inability to use the Work (including but not limited to
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
any and all other commercial damages or losses), even if such Contributor has
been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability.

While redistributing the Work or Derivative Works thereof, You may choose to
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
other liability obligations and/or rights consistent with this License. However,
in accepting such obligations, You may act only on Your own behalf and on Your
sole responsibility, not on behalf of any other Contributor, and only if You
agree to indemnify, defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason of your
accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work

To apply the Apache License to your work, attach the following boilerplate
notice, with the fields enclosed by brackets "[]" replaced with your own
identifying information. (Don't include the brackets!) The text should be
enclosed in the appropriate comment syntax for the file format. We also
recommend that a file or class name and description of purpose be included on
the same "printed page" as the copyright notice for easier identification within
third-party archives.

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
196 changes: 196 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
![](https://github.com/DJ-2805/DigiPyRo/blob/master/util/SpinLabUCLA_BW_strokes.png)

DigiPyRo is a program designed to digitally rotate a movie and allows
for single-particle tracking. This was originally designed to
intuitively show Coriolis force effects through the appearance of
inertial circles when digitally rotating film of a ball oscillating on a
parabolic surface.

The Python 2.7 version of the code was created by [Sam
May](https://github.com/sam-may/DigiPyRo) and the current version is
maintained by [David James](https://github.com/DJ-2805) in conjunction
with the [SPIN Lab](https://spinlab.epss.ucla.edu/) at UCLA.

Setup
=====

You'll first need to get the files needed to install and run DigiPyRo.

1. First download the files needed. You can either follow
[this](https://github.com/DJ-2805/DigiPyRo) and download the files
or if you have `git` on your terminal you can download through
terminal.

``` {.bash}
git clone https://github.com/dj-2805/digipyro
```

- If you instead followed the link, then click on the green
`Clone or download` button, and download the repository into
your machine

Installation
============

This SOP assumes that you have python already installed. Before you get
to run DigiPyRo you'll need to install the dependencies so the program
can run. Because of how most of this program is setup, you will do most
of the interaction with code through the terminal.

1. If you are on Windows, open the `Powershell`. If you are on Mac,
open the `Terminal`.
2. To verify that you do have Python, run the following command

``` {.bash}
# windows machine
python --version

# MAC machine
python3 --version
```

- you should see an output of Python 3.x.x version number. If you
see Python 2.x.x, you will need to reinstall your Python.

- NOTE :: Some machines need `python3` being called explicitly
rather than `python` in terminal calls. If this produces the
correct version, then any future commands you see in the rest of
the instructions will require `python3` being typed rather than
`python`

3. First make sure your package manager is up-to-date.

``` {.bash}
# if you are on a Windows machine, run this command
python -m pip install --upgrade pip

# if you are on a Mac, run this command
pip install --upgrade pip
```

4. Next you will need to move over to the the directory that contains
the files that you unzipped.
5. Now you'll be installing the dependencies.

``` {.bash}
pip install -r requirements.txt
```

Synthetic Movie Program
=======================

At this point, you should have Python and all the dependencies to run
the programs. This first program creates a synthetic .avi movie for use
with DigiPyRo. If you already have a film from experimentation, then you
can skip this program, and move to the DigiPyRo program below.

The video shows a ball rolling on a parabolic surface, where the user
may change the video length of the movie, frame rate, resolution,
frequency of oscillations, rotation rate of the reference frame, and
control the inital conditions of the ball.

1. You will still need the terminal at this point, so open it up if you
have closed it.
2. To see the `help` message for the the movie program type

``` {.bash}
python synth.py -h
# or
python synth.py --help
```

3. You should see the following messaged

``` {.org}
usage: synth.py [-h] [-t TIME] [-f FPS] [-w WIDTH] [-l LENGTH] [-r EQPOT_RPM] [-R CAM_RPM] [--r0 R0] [--vr0 VR0] [--phi0 PHI0] [--vphi0 VPHI0]

This program creates a synthetic .avi movie for use with DigiPyRo. The video shows a ball rolling on a parabolic surface. The user may change the length of the movie,
the frame rate, the resolution of the movie, the frequency of oscillations, the rotation rate of the reference frame, and control the initial conditions of the ball.

optional arguments:
-h, --help show this help message and exit
-t TIME, --time TIME The desired length of the movie in seconds. (default: 5)
-f FPS, --fps FPS The frame rate of the video (frames per second). Set this to a low value (10-15) for increased speed or a higher value (30-60) for better
results. (default: 30.0)
-w WIDTH, --width WIDTH
The width in pixels of the video. (default: 1260)
-l LENGTH, --length LENGTH
The height in pixels of the video. (default: 720)
-r EQPOT_RPM, --eqpot_rpm EQPOT_RPM
The deflection of a stationary paraboloid surface as if it were an equipotentional in a system rotating at the specified rate. A good value
would be between 5 and 15. (default: 10.0)
-R CAM_RPM, --cam_rpm CAM_RPM
The rotation rate of the camera. The two natural frames of reference are with rotRate = 0 and rotRate = rpm. (default: 0.0)
--r0 R0 The initial radial position of the ball. Choose a value betweeon 0 and 1. (default: 1.0)
--vr0 VR0 The initial radial velocity of the ball. A good value would be between 0 and 1. (default: 0.0)
--phi0 PHI0 The initial azimuthal position of the ball. Choose a value between 0 and 2*pi. (default: 0.7853981633974483)
--vphi0 VPHI0 The initial azimuthal velocity of the ball. A good value would be between 0 and 1. (default: 0)
```

4. The program has several flags, and all of them have default values
described in the help message. The program can be run in several
different ways, where you run it with it's defualt values or you
change the flags desired to have a video produced. Note, when you do
run it, you'll be prompted for a movie name. The produced movie will
be in `.avi` format, so only a movie name will be needed. Examples
are shown below:

``` {.bash}
# running the program with just its default values
python synth.py

# running the program with changing one value
python synth.py -t 10

# the same but using the full flag name
python synth.py --time 10

# running the program with multiple flags
python synth.py -t 7 -r 15 --vr0 3
```

NOTE
: Depending on the parameters given and how powerful your machine
is, this could take a couple minutes for it to create your film.

5. After the program completes, you should see your movie file created
in the same directory.

DigiPyRo Program
================

Now to run the DigiPyRo program you'll need a video and to set some
parameters. The DigiPyRo program runs through a GUI, but will still need
a terminal command to get the program started.

1. Run the following command to get DigiPyRo started.

``` {.bash}
python DigiPyRo.py
```

2. You will see a GUI window appear, where you can input values for
each area.
3. The values are based on either the video you created from synth.py
or a lab experiment you ran beforehand.
4. For the `full filepath to movie` parameter, unless the video is in
the same directory as `DigiPyRo.py`, you must specify the entire
path. Furthermore, you must specify the extension of the movie (i.e.
.avi, .mp4, etc.).
5. For the `Save output video as` parameter, only the file name needs
to be given. The extension will be added after the program executes.
6. For the `Start and end times` parameter, the end time should be a
bit shorter of the true end of the film (i.e. if the film is 5 secs
long then this `end time` should go to 4.8). This is a current bug
that I came across; sometimes the program goes out of index if the
full length of the film is given.
7. For more description and instructions on the programs refer to
[Sam's Instruction
PDF](https://github.com/DJ-2805/DigiPyRo/blob/master/Examples/BasicExamples_v3.pdf).

NOTE
: Sam's PDF is out-of-date for some instructions, because the
program has been changed, but still gives description and images
on some of the steps.


Loading