Pages

Matplotlib y-axis label not displayed when saved as .eps .pdf file

I encountered this error in matplotlib.pyplot.

When I tried to save the plotted graph in matplotlib, the y-axis label was not displayed in the saved file (.eps, .pdf, etc files).

Just add this line (as a previous line) before saving the graph as a file using savefig command.

plt.tight_layout()

The problem will be solved and the saved file will contain y-axis label.


Matpotlib error: Image size of 3831x7771797 pixels is too large. It must be less than 2^16 in each direction.

This is due to the large file size of the figs. you have plotted.
If you get this error, you may not visualize the figure(s) on the matplotlib.
However, you can save as a file (.pdf or .eps ir .png) and you can open and see the figures.

If you want to elimate the error message, the only solution is to decrease the file size (you may decrease the size of the figure or the pixel size)

Here is a related post in GitHub.
https://github.com/matplotlib/matplotlib/issues/16234


Another reason you may get this error may be due to the following reason.

If you have plt.text option as follow,

plt.text(6.0, 7.4, '(b)', ha='center', va='center', fontsize=14, rotation='horizontal', fontweight='bold')

then, this may be causing the problem (especially if you use alreadying existing script to plot figs.)
To solve this problem, just comment this plt.text() using # and try to save the file.
Now, if there is no error, you just adjust the location of the text values in the plt.text() to proper place.

This would solve this error.



How to translate documents from one language to another language using google drive (google docs)?

How to translate documents from one language to another language using google drive (google docs)?

You can convert .doxc or .doc file from one language as follow:

1. First, upload the file (e.g. .docx) to google drive (Since the file is in .docx format, you can not find the translate option in Tools.)

2. Now Go to File --> Save As Google Docs.

3. Go to the file converted google docs. In this document, chose:
   Tools --> Translate --> (select the language)

Now you will get the translated .docx doument.

Hope this helps. Comment here if this is useful.

Using ls command (ls) to sort file names by number.

If you work with a lot of files, you often save the files with numbers for each system.

For example, 

1sample.out
2sample.out
3sample.out
4sample.out
......
......
......
......
10sample.out
11sample.out
12sample.out
.......
.......
Nsample.out

Suppose, you want to extract some information from these files in order from 1sample in order. If you type 'ls', the file 10sample.out will be listed first. You will get list as follow. So the extracted info will be different from what you expect as follow.

10sample.out
11sample.out
12sample.out
...... 
......
15sample.out
1sample.out
2sample.out
.....
.....
Nsample.out

To order file names based on the numbers in the file, use 'ls -v"

Now, the files will be ordered properly.

So, to list the files based on the numbers, use:

ls -v *.out    [to list files with extension .out]

This is a series of post on the "Efficient use of Linux" as well as "Linux Tips for beginners" series. To see all the post, click the link on the right side. 


Using ls command to list all the files in the current directory recursively:

Use:

ls -R

This will list all the files int he current directory recursively.

Jupyter-notebook not running after Ubuntu upgrade

$ jupyter-notebook 

Traceback (most recent call last):
  File "/usr/local/bin/jupyter-notebook", line 7, in <module>
    from notebook.notebookapp import main
ModuleNotFoundError: No module named 'notebook'

$pip install jupyter --user installed the jupyter-note book.

But I want python3 version.
I tried to install jupyter using following command.

$ pip3 install jupyter --user

Traceback (most recent call last):
  File "/usr/local/bin/pip3", line 7, in <module>
    from pip._internal import main
ModuleNotFoundError: No module named 'pip._internal'

To solve this problem do the following.
Remove the installed jupyter using:

$sudo apt-get uninstall jupyter (and hit 'y' to confirm)

or,

$pip uninstall jupyter

and update using:

$sudo apt-get update

Now do the following:

$sudo apt-get install jupyter-notebook

Now, you can open the jupyter-notebook.

Symbols above the letters (for scientific publications)

When writing papers, we often come up with author(s) names with symbols above some characters of author(s) names.

How do you use those symbols in LaTeX?

Here is a Wikipedia link where the details are provided.

https://en.wikipedia.org/wiki/Diacritic

In order to use in LaTeX, a number of answers in the following SE site is given.

https://tex.stackexchange.com/tags/accents/info

Some of the frequently used symbols are (from SE site):

Text mode

Plain TeX makes it possible to typeset the most commonly used accents:
  • \` (grave accent): à
  • \' (acute accent): á
  • \^ (circumflex or “hat”): â
  • \" (umlaut or dieresis): ä
  • \~ (tilde or “squiggle”): ã
  • \= (macron or “bar”): ā
  • \. (dot accent): ȧ
  • \u (breve accent): ă
  • \v (háček or “check”): ǎ
  • \H (long Hungarian umlaut): ő
  • \t (tie-after accent): a͡
  • \c (cedilla): ş
  • \d (dot-under accent): ạ
  • \b (bar-under accent): ο̩
  • \k (ogonek): ą
The Unicode character encoding UTF8 includes several special characters and characters with accents. The following code specifies that the encoding of the LaTeX document source file is UTF8. As font encoding is specified T1, because it supports the encoding of extended character sets in fonts:
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
Of course, the encoding in the text editor needs to be set to utf8, as well.

Math mode

The following commands may be used only in math mode to produce accents;
  • \hat{o} (circumflex): enter image description here
  • \widehat{oo} (wide version of \hat over several letters): enter image description here
  • \check{o} (vee or check): enter image description here
  • \tilde{o} (tilde) enter image description here
  • \widetilde{oo} (wide tilde) enter image description here
  • \acute{o} (acute accent): enter image description here
  • \grave{o} (grave accent): enter image description here
  • \dot{o} (dot over the letter): enter image description here
  • \ddot{o} (two dots over the letter): enter image description here
  • \breve{o} (breve): enter image description here
  • \bar{o} (macron): enter image description here
  • \vec{o} (vector (arrow) over the letter): enter image description here

Fortran Resources (recipes, libraries, learning materials, etc)

Fortran95 features
from Wikipedia

List of Fortran Numerical Libraries
from Wikipedia

Numerical Methods for Fortran Programmars
from people.sc.fsu.edu
contain links to fortran libraries and subroutines

Scientific Programming and Numerical Computation
from Wu-ting Tsai, National Taiwan University.

Fortran95 Interface to Matlab
from Matlab

Fortran Resources List
from BCS Fortran Specialist Group

Fortran Wiki
contains tutorials and FORTRAN code collections
contains list of links that contain FORTRAN codes

Fortran Tutorials ( a list of tutorials)
a list form The Fortran Company

Computational Physics using Fortran (official link)
an NPTEL course with a brief introduction to Fortran

Fortran90 Tutorial 
From MTU


How to read a technical book (Physics, Chemistry, Maths, CS, engineering, etc)

If you want to read a novel or biography, go ahead.

But for a technical book which is full of concepts, mathematical equations, etc, you need to find out a suitable way to read those books. Actually, in schools and colleges, the first course should be how to read books. 

Here are some of my notes on how to read technical books.

In LinkedIn I read "not all books are for everyone". 

First answer these questions before starting to read the book.
  1. As yourself "Why do I want to read this book?"
  2. Go through the table of content. After that, make sure that you want to read this book.
  3. Does the content of this book meet my requirement?
  4. If that book contain mathematical equations, do I need paper and pencil to practice as I read; or if your book is related to computer science programming, then, do I need to practice in a computer while reading the book? Answer this question. 
  5. Have I read similar book earlier or this is completely new? 
Why reading a technical book is hard?
  1. book contains many technical terms
  2. book contain rigorous mathematics beyond our comprehension
  3. the programming book contain complicated syntax and difficult algorithms 
  4. the book assumes that you have pre-requisites such as prior programming knowledge or math knowledge 
You may think that mere patience is enough to complete and comprehend and understand any technical book. Now also I am thinking so (which is going to change soon). But, this is not working.

Unless it is a must read book, check following.

You must read the perquisite first. In my opinion any technical book should mention what the author assumes to have known by the readers. But, most of the authors fail to do so. Similarly, any course description should start with perquisites. See the courses in MIT OCW. For all the courses, the prerequisites have been given which is a very good practice that everyone should adapt. A preface should contain this information.

Now steps to read the book.
  1. read the preface
  2. gently go through the entire book like bird eye view. In this stage, you can read the head title. But, don't even go through the subtitle. Just hover around the book once. 
  3. Then, read the contents
  4. Go through each chapter, subtitles, figures, tables, diagrams, etc. Just look at the equations but don't try to comprehend the equation.
  5. Then, again read the contents
  6. Now, go through each chapter and read the title, subtitle, first and last sentence of each paragraph. Reading the first and last sentence of any paragraph should summarize the information in that entire paragraph. A well written piece of anything (article or book) should obey this rule
  7. points 1-6 should be done in a single sitting. Points 7 8 and 9 may take many days or even weeks or months to complete based on the difficulty, depth, subject, your expertise in the field, etc.
  8. In the next step, go through the entire book without doing anything practical such as working out the equation in a math equation intense book or doing coding in a computer while reading. Just go through the text and everything and try to comprehend the book. While reading, take important points, write unknown things, write what you need to learn a specific part in the specific unit, etc.
  9. Then, learn what you need to learn before understanding this book. Otherwise, you are wasting your time. If a particular unit uses a specific mathematical equation and you don't know its physical meaning, then what is the use? If that portion is out of your interest or you want to neglect at present, write what you omit (for later reference)
  10. After that, if you read a math book, have a notebook and pen. If it is programming book, have a computer to check the code. Practice the math/programming while reading through each chapter. While doing this you can revise your notes by adding or minimizing the notes you wrote in the previous step. Once you complete this procedure, you will be a master in that subject.
  11. Make sure to go through the entire book and you understand each and everything there.
  12. Before completing this book, don't ready any other book either on the same topic/subject. For example, if you read Quantum Mechanics by R Shankar, you should follow the procedure till you finish the book. While you complete the first chapter of the book, don't take another book on Quantum Mechanics with some other author. No matter how much another books is better or best, once decided a book, go through it entirely. You have a way. Some concepts or portions in your selected book may be hard to understand. Note down those parts and you can check those topics in other books after completing this book. But never ever take the second book while reading the first book. This is the biggest mistake I am doing for the entire life so far. I am changing now. That is why, choosing a book for reading is the very book step. Once chosen, stick with that book. Don't go to other books. In contrast, if you are reading novel or biography books, or fiction/non-fiction you can pick one book on each category and you can switch between each of these books. 
What do you think about this article? 

Write your thoughts and comments here.






Journals for Machine Learning and Deep Learning applications

Here are the list of journals that publish papers in machine learning applications.

https://www.tandfonline.com/loi/uaai20?gclid=CjwKCAiAsIDxBRAsEiwAV76N8-hqz0nV_zroA4jazsDqBaakJPmrUgi_X_hYzjkLNKe6i5SqFkZvnhoC0vkQAvD_BwE
https://www.journals.elsevier.com/pattern-recognition-letters
https://www.journals.elsevier.com/artificial-intelligence
https://www.nature.com/natmachintell/
https://ieeexplore.ieee.org/xpl/RecentIssue.jsp?punumber=5962385
https://www.journals.elsevier.com/neurocomputing
https://www.worldscientific.com/worldscinet/ijait
https://www.worldscientific.com/worldscinet/ijprai?campaignid=336010695&adgroupid=23075846775&creative=81823290255&keyword=&gclid=CjwKCAiAsIDxBRAsEiwAV76N8z5zITmxaVXQqeB-kOkTUcYw6uPEL754iVotNoSgYCXHYrNd7PUE8hoCkx0QAvD_BwE
https://www.tandfonline.com/toc/teta20/current
https://www.journals.elsevier.com/information-sciences
https://www.springer.com/journal/10044
https://www.journals.elsevier.com/pattern-recognition
https://www.journals.elsevier.com/neural-networks
https://www.springer.com/journal/10994
http://www.jmlr.org/
https://link.springer.com/journal/10618

Tools for reviewers

If you review research articles, or aspiring researcher, following links may be useful to you.

PubPeer
Publons
COPE
Retraction Watch

You may be interested in these posts

Error in image file conversion: convert-im6.q16: not authorized `test.eps' @ error/constitute.c/WriteImage/1037.

This error is because of the vulnerability. This allows remote execution of code using image formats. So, some Linux distributions by defaul...