Dealing with plotting negative, zero and positive values in log scale

Posted on Wed 30 March 2016 in Misc • Tagged with Python

Sometimes you have to show positive, zero and negative number in log scale. However you cannot take log of negative numbers and zero. But one could approximate it with a log transform modulus as stated here.

In Python with numpy:

from numpy import sign, abs, log10  
import matplotlib.pyplot as …

Continue reading

Generating plasmonic metal dielectric functions in Python

Posted on Thu 10 September 2015 in Plasmonics • Tagged with Python

I keep needing a python code to generate the dielectric functions of plasmonic materials such as Au, Ag, Pd, and Pt. So I wrote a python version of LD.m.

LD.m is a matlab file written by Bora Ung …


Continue reading

DDSCAT on amazon EC2

Posted on Thu 03 September 2015 in Plasmonics • Tagged with DDSCAT

Amazon provides high performance computing capabilities through their EC2 service. You can find more information here

They provide a 750 hr free instance with their a free-tier program. If you want more resources, you can pay for it. See the pricing, pricing seem very reasonable.

I wanted to see …


Continue reading

Plasmonic Materials in MEEP > 1.2

Posted on Sat 13 June 2015 in Plasmonics • Tagged with electromagnetism, FDTD, MEEP, octave, Plasmonics

Here is how I was implementing plasmonic materials in meep 1.1. Unlike Meep 1.1, Meep >= 1. 2 changed the way materials are defined.

Here I will describe how to change the material definition code from meep1.1 to meep 1.2 . Please note that one can still use …


Continue reading

Doorbell with NRF24L01 and Arduino

Posted on Fri 29 May 2015 in Electronics

My current apartment does not have a doorbell (Its strange but it is true). I went ahead and built a doorbell using two arduino pro-minis and two NRF24L01 transceivers. The melody to be played when a guest presses a button can also be controlled. I have four melodies programmed in …


Continue reading

Airtel tune on arduino

Posted on Thu 21 May 2015 in Electronics • Tagged with Arduino

For my doorbell project, I needed some melodies to be played on arduino. One can takes notes of a melody and write a corresponding arduino code.

I like airtel tune and wanted to play it with arduino. I got the notes from https://www.youtube.com/watch?v=3m5j5UIRqQc

Here …


Continue reading

Controlling Rigol Dp832 with python

Posted on Fri 08 May 2015 in Electronics • Tagged with Instrumentation, python

DC power supplies are very handy for electronic projects. They help to apply bias/voltage to a device. Controlling it by a computer by a program is helpful in advanced projects where timing and accurate control is an issue.

I got my hands on a RIGOL DP832 which is three …


Continue reading

Hacking Weighing Scale to Upload Weight to Plotly using Raspberry Pi

Posted on Sat 11 April 2015 in Electronics • Tagged with python

I have been interested in monitoring and keep track of my weight. In the past, I have used different phone apps to track my weight. They work reasonably well, but I was thinking of reading weight data directly from my weighing scale and upload the data to an online database …


Continue reading

Controlling Newport 1918 Power Meter with Python

Posted on Sat 04 April 2015 in Electronics

Optical power meters in-conjunction with a detector are used to measure power from a laser source or monochromatic output.

At work, we use Newport 1918 power meter. This power meter comes with its own software. However, I was interested in controlling this instrument with python.

I wrote a python module …


Continue reading

Controlling SP2150i monochromator with Python/PyVisa

Posted on Fri 19 September 2014 in Electronics

Monochromator is used in optics research where a narrow bandwidth of light is required to be illuminated on a sample. I work with Princeton Instruments Acton SP2150i and needed a python program to control it.

I found the manual here and on page 9-10, I saw the serial commands for …


Continue reading