Wednesday, November 26, 2014

Tag clouds in R

An easy way to visualise the concepts that are important in a text is to create a tag-cloud where the most common words are written large and less common words are made smaller and smaller. We want to remove the really common words first so that we avoid creating a cloud with only "in", "of", "for", "the", "a", "an", and so on. There are a number of web-based applications that will do it for us, but where is the fun in that when we can do it in R?

The first question is which words to use. It boils down to finding a suitable text that really reflects the research. The best I have come up with is using article titles. First we copy all the article titles into a single file, and then we rearrange them so that there is a single word on each line. This makes it easy to import into R as a matrix using:

> ArticleTitles = as.matrix(read.csv("file-with-title-words.txt"))

The "as.matrix()" is needed since read.csv automatically imports files as data frames, while the package we are going to use accepts only matrixes. The package in question is wordcloud, which we get it by running the following code at the R-prompt:

> install.packages(c("wordcloud", "tm"))

and loading them with:

> library(wordcloud)
> library(tm)

Thereafter it is as easy as:

> wordcloud(ArticleTitles)

As the default this produces a cloud of up to 300 words that appear a minimum of 3 times using black text on white background. It removes all punctuation and common words automatically. There are a lot of different parameters that we could fudge to get a better-looking cloud but that is left to the reader to try out. In order to make the cloud look like a kidney we can just run the code a number of times until something vaguely kidney-like appears, and then import the image to Adobe Illustrator to make it even better. Finally a light gray outline of a kidney is introduced as background to make the shape more obvious. 

Monday, September 15, 2014

Keeping current

It is a bother to keep current with the scientific literature. Everyone knows it is growing exponentially, although if you look at the new publication histograms on Pubmed they look rather linear. At least over the years after which most papers were actually submitted to Pubmed upon publication, i.e. 1990ies and later. If you pull out the number of publications per year on a given search, let us say "blood pressure" it looks like this:
It rises in fits and starts probably depending on how far back different journals have decided to back-register. If you look at the second graph there does seem to be a flattening of the curve in the sixties and onward indicating that the growth may be linear after all. Sadly, for blood pressure that means 18 000 articles per year as of 2014, and the rate increases with another thousand per year every three years. Working in several fields means trying to keep up with each of them, and makes for a grand total that does not bear thinking about.

Luckily the journals provide current contents feeds that one can read using a RSS. I used Google reader until that was cancelled and now I have moved to the brilliant service CommaFeed, which provides a very clean RSS-reader interface. Below is a screenshot of my current list of journal feeds.
With this kind of list you get a couple of hundred new publications every week, so there is no chance of reading all of them. What I do is skim the titles and selected abstracts in the reader, anything that appears interesting and relevant I will send to Papers to read more thoroughly. In addition, I regularly scan Pubmed for relevant articles, as you do when writing papers, grants, and lectures.

Thursday, September 11, 2014

Fujifilm X100T

Fujifilm announced the X100T and Zack Arias has a review up on DedPxl. It has a larger buffer for continuous shooting, a better back-contol layout, and a digital rangefinder to make manual focusing better. In addition, its faster, has higher resolution (than the x100), larger screen, and is a little bit thinner. All good in my book.

Sadly, it does not have a mechanical ISO dial, but I have a solution for that. Fujifilm could easily release a firmware update that makes it possible to use the exposure-compensation dial to set ISO. We who like that could then make a little sticker to place over the top, and we'd be all set.
So, please Fujifilm. Pretty please, make a firmware update to make it possible to use the exposure-compensation dial to set ISO. I think a lot of photographers would be very happy.

Wednesday, July 30, 2014

Wishes for the Fujifilm X200

With photokina right around the corner I have suddenly started shooting a little again. The X100 is still a magnificent camera, but I have some gripes and some hopes and wishes for the next iteration. A lot was improved with the X100S but not enough for me to buy a new camera. However, the Fujifilm X-T1 has many of the asked-for features, which shows that Fujifilm is heading in the right direction. Here is a list of what I would like to see in a new X200 (or whatever they will call it).
Concept for the new X200, very similar to the old X100/X100S but with some new switches.

  1. Continuous shooting with a proper buffer so that it is possible to continue shooting immediately after a short burst. On the Canon EOS1D you could shoot a burst and shoot another burst immediately. Even on the X100S you have to wait interminable seconds even if you only shot a two-picture burst.
  2. Shooting priority shutter release. That is, when the button is pushed all the way down the picture is captured, no waiting for autofocus, no nothing.
  3. Focus tab on the focusing wheel with always-on manual focus that automatically brings up digital split image or peaking. (On the lens focus wheel)
  4. Dedicated shooting-mode switch: Single - Macro - Continuous. Macro is in the middle because if you shoot macro you have the time to be precise when changing mode. (Drawn on the left top edge)
  5. Dedicated ISO-dial that you have to lift to turn to automatic. (Below the shutter release)
  6. Dedicated flash-mode switch. (Behind the flash shoe)
  7. Dedicated film-mode switch (Under the shutter-speed dial) with a lock button that you need to press to change it. A lock button that you also need to press to select A, B, or T on the shutter speed. (On top of the shutter-speed dial)
  8. Dedicated switch for the neutral density filter. (Behind the shutter-speed dial)
  9. Larger menu and arrow buttons, a dedicated back button and a large touch screen.
In short, I would like more manual control with easily visually verifiable settings. Oh, and a faster camera. 
Here is a picture of Madicken and her new friend Vilde captured with the X100.

Wednesday, July 23, 2014

Pathophysiology of cardiorenal syndrome

Am I writing about actual science? Yes, apparently so. Thing is, the American Physiological Society has graciously decided that all corresponding authors of reviews and editorials would get 50 free reprints (useless), or a toll-free link (useful). However, in order to use said link you have to provide a specific URL of origin, wherein lies the problem. I don't trust the university to maintain my homepage anymore seeing as they just closed it down in favour of their new database-based system that I cannot do stuff with. So, this is the post where I will place the link.

The article was an invited review connected to an abstract sent to Experimental Biology 2014 in San Diego. It is basically a walk through of how nervous and hormonal signalling affects kidney function in heart failure and thus contribute to the development of edema, and the worsening of both heart failure and kidney function in a vicious circle.

The title is: Renal neurohormonal regulation in heart failure decompensation, and it was written together with my present students Sofia, Mediha, and Jacqueline who are still in the lab, and Fredrik who have since moved on to his clinical internship.

For the time being you will have to make do with a (non-toll free) link to the article: LINK

Edit: Here is the toll-free link: Renal neurohormonal regulation in heart failure decompensation. By Sofia Jönsson (PhD-student), Mediha Becirovic Agic (PhD-student), Fredrik Narfström (MD-student), Jacqueline Melville (postdoc), and me.

Saturday, February 22, 2014

Sketchbook Ink on the iPad

There's a new sketching program for the iPad. Yes, I realise it isn't that new anymore, but it's new for me. The program is Sketchbook Ink from Autodesk, the same company that gave us AutoCad and more important in this case, Sketchbook Pro. It is available for both the iPad and Android.The main difference is that Sketchbook Ink is vector based, which means that you can zoom in as much as you want without loosing resolution or getting a pixelated image.

The tools are quite limited, just a small selection of brushes and erasers. But you can vary the line-weight easily with a slider at the bottom. It is very easy to ink a drawing and the brushes behave well and predictably. Here is one of my old judo drawings which has been inked really quickly. Further, the program handles layers in an admirable way.
The program has some drawbacks, in my book the main missing features are:
  • Vector selection.
  • Filling, ideally including gradients.
  • Export to a vector-based format.
So, what Autodesk has done is create a very nice and simple vector drawing program, and then they have handicapped it by not including access to the very vectors it is based on. That could have been an reasonable choice in order to make the program as simple as possible, if only they had allowed us to export the vectors so that we could work with them in another program. As it stands, Sketchbook Ink is just a toy, and not really worth your time and money.

Sunday, August 11, 2013

Judo techniques - Free to use illustrations

Previously on Nephrophysiologist we looked at some free judo illustrations that our club were potentially going to use for grading hand-outs. The number of illustrations has grown steadily, but the first actual use the pictures have seen is the poster at the top. It isn't half-bad if you ask me, but then I may be biased.

Work-wise the bulk of the time was spent trying to re-size all pictures so that the figures appear to be about the same size. Then a quick levels adjustment to get rid of the slight gradient that Art Rage uses for a background, and a hue/saturation adjustment to make the blue gis blue rather than purple. Finally I had to trace-down the font used for an old club T-shirt. After much searching and many, many pages of fonts a friend of a friend identified it as Grenoble. Then it was easily found at our friendly font repository.
To finish off I would just like to remind everyone that there is a repository of free, as in speech and beer, judo illustrations to be had under the Creative Commons - attribution, share-alike - license on flickr.com and most of them can also be found at the wikimedia commons. This here below is sasae-tsuri-komi-ashi perhaps done best in the history of the world by Muneta Yasuyuki. However, it usually looks more like slow collaborative falling.