Tag Archives: Tutorial

datasync

Data syncing and backUP

When we look around us , we are surrounded by data and a lot of information. But in this post I will not be talking about those objects (as they are called in object oriented programming). In this data refers to all the qualitative and quantitative set of information and variables we have stored in our computer. These data be it just collected, reported or even analysed are very crucial for every one. Every individual encounters different type of data. This page will classify different types of data for interested readers.

This post focuses on data back up and syncing. In simple words, it is the act of replicating data between two storage units, but the storage needs to be mirrored. That means change to one will be reflected to the other and vice versa. The advantage of this is that it saves a lot of time than the general copy pasting, and of course it is the ability to preview the changes before they are actually made.

For syncing there are various software in the market, some commercial and some open source applications.  Personally ,I use SyncToy, and have described the process to sync in this post. The good things about this software is it is a freeware and it has a very simple GUI to get the work done.

So here we go.

  1. Install the SyncToy software by downloading it from here.
  2. Once installed, open up the application.
  3. On the window that pops up, click on Create New Folder Pair.
  4. Now choose the folders that you want to sync. Left is the source folder path, Right is the target source folder path.
  5. Click NEXT.
  6.  The next window that follows asks about the type of sync, viz;
    Synchronize: Updates files both ways…keeping changes like renames, deletions and edits to either folder contents the same between the two.
    Echo: New and updated files are copied left to right. Renames and deletes on the left are repeated on the right.
    Contribute: New and updated files are copied left to right. Renames on the left are repeated on the right. No deletions.
  7.  I will recommend using the Contribute option.
  8.  After that, name your syncing action. Choose a suitable name in case you are syncing between different target sources. Click FINISH
  9. On the next window, click RUN, to see the software syncing your data from the source path to the target path.
  10. Once done, click CLOSE to see the report of syncing
  11. To schedule the syncing automatically,  go to Task Scheduler option in windows 7.
  12. Click on Create basic Task
  13. Next type a little name and description to the task like ” DataSYNC SyncToy”
  14.  Go to the trigger option, and select the frequency of syncing up to your convenience.
  15. In the Action tab of the window,  type “C:\Program Files\SyncToy2.1\SyncToy.exe” where it asks for Program/Script.
  16. In the add argument section, type -R
  17. Click Finish to get things done.
  18. Have it a go !
mavg

A simple moving point average in Matlab

A simple  moving point average in MATLAB.

A moving average or a rolling average is one of the most common smoothing technique used to extract a good signal out of a very random noisy signal. This technique is usually used to see the behavior of a function or  a signal, when the physical parameters and environment have an erroneous effect on the measured signal.

Given a series of numbers and a fixed subset size, the first element of the moving average is obtained by taking the average of the initial fixed subset of the number series. Then the subset is modified by “shifting forward”; that is, excluding the first number of the series and including the next number following the original subset in the series. This creates a new subset of numbers, which is averaged. This process is repeated over the entire data series. The plot line connecting all the (fixed) averages is the moving average. A moving average is a set of numbers, each of which is the average of the corresponding subset of a larger set of datum points. A moving average may also use unequal weights for each datum value in the subset to emphasize particular values in the subset.

The general technique involves finding the mean  from an equal number of data on either side of a central value. This ensures that variations in the mean are aligned with the variations in the data rather than being shifted in time. There can be some anomalies when the variation is not uniform as well, but this will not be discussed here.

There can be different types of moving point averages like  the

  • Cumulative moving average
  • Weighted moving average
  • Exponential moving average
  • Modified moving average, and
  •  Regression  moving average methods

In this post I have attached a MATLAB code to do a simple moving average. This code can be used to smooth a signal with some nice feature but with a small background noise without compromising on the data value. But be careful on the window span of the average for your own data.

Find the code here:

 

 

tc-turbo-c-software-interface

Guide to good programming in Matlab

Computational Physics by using Matlab

Computational physics can be regarded as an amalgamation of physics with mathematics and computer science. Computers these days have changed the way physics (and all sciences) is done, and computational physics is now widely accepted as an equally valid approach to Physics after Experimental and Theoretical approach.

Matlab is one of the nicest platform to do these physics and has been gaining a lot of popularity in problem solving  these days owing to its visibility and seamless integration feature. You can read more about Matlab here:

Some recommended books for Matlab are:

But Matlab as a platform is really colossal and like and ocean, so we need to be specific about the reason we are using Matlab .

Guide to Good programming:

If it is asked; What are the most important characteristics of a good program,or what do you mean by a good program?

Many people or mostly all will say efficiency and speed. Efficiency can have more synonyms like reliability, accuracy, perfectness etc.  Yes indeed that’s true not very true though. Efficiency and speed are really crucial characteristics of a program but they do not define a program to be a good program or a bad program.

 

report-card-pic

A program that is not efficient or accurate is of not much value , yet it still can be used if we understand the limitation of the program or what contain the accuracy of the code. We need to be the gentle and caring teacher who helps its pupils to understand the lessons. And for the speed; what matters is how long it takes to solve the problem and not how long to execute the program. So the speed can sometimes be traded for more accuracy (at least for experimental physics in which you use Matlab to talk to instruments and order them to solve your work)

Q: So, what is then the most important characteristic of a good program ?

Ans:  It is the clarity of the code that is the most or very crucial aspect of the code.  If its not clear what is the code doing then it is not a good code. If the code does not clearly describe the logic and algorithm of how it is doing our work, then it is not a good code. Unless you are in the receiving end of the code and believe in Data abstraction ideology.

On the other hand, if a code is clear and describes the use of each module, variables, algorithm then we are more likely to understand what is is intended to do. If or when there is an error, we can then very easily cure it as we understand the code, because of its clarity.

A standard problem solving approach for any problem or code is to break the code into smaller chunks called modules. This gives a better understanding of the total problem.This aspect is called as top-down design by physicists.

Capture

Another way to enhance the clarity of a code is to use valid variable names. Imagine reading a computer code asking to solve and integration of sin x over some space, and in the code you encounter a variable name as win32. What sense would  that make?  So employ using valid variable names and also make sure that the code does not have several variables doing the same operation. Try to extract maximum information and utilization from one single variable before it is cloned for some operations which can not be avoided.

This post is all about a basic tutorial of how to code in any programming platform. So start constructing some nice codes.