12:15 AM
@Szabolcs No problem. You should now be able to get yourself a "Self-Learner" at that site. ;)
(Also, I'm trying to implement that Color Spiral thing in Mathematica right now; it got me curious.)

@MrWizard Still need three votes, but you have a shiny new silver badge!

@rcollyer Indeed I do! :D * * happy dance * *
Thank you all for giving me that badge. It's not the reason I answer questions but it does make it more fun.

12:51 AM
@MrWizard Holy shit, I hadn't noticed that! Congrats! I was referring to the Good Answer badge on English Language and Usage.

5 hours later…
5:58 AM
@rcollyer FWIW: I wrote a simple molecular energy diagram generator that uses the eigenvalues of molecular hamiltonians (under the Hückel approximation) as its input. Actually it works with any numerical list, so you could view the spectrum of any matrix with it, but to me only that particular case is useful. It's pretty hacky, but I think I've got it right. I added a step to check if there are more eigenvalues than lines drawn, just in case.
I also have the code to generate images of the Hückel MOs from SMILES, but adding that to the energy diagrams seems a bit overkill to me. Anyway, here it is, if you're (or anyone) remotely interested.
huckelEnergyDiagram[eigenvalues_] := Module[{workelist, lines},
workelist = Tally[Sort[Rescale[eigenvalues]]];
lines =
Table[{{0, workelist[[i, 1]]}, {1, workelist[[i, 1]]}}, {i, 1,
Length[workelist]}];
Table[For[workelist, workelist[[i, 2]] > 1,
workelist[[i, 2]] = workelist[[i, 2]] - 1,
lines = Append[
lines, {{0 + 1.5 (workelist[[i, 2]] - 1),
workelist[[i, 1]]}, {1 + 1.5 (workelist[[i, 2]] - 1),
workelist[[i, 1]]}}]], {i, 1, Length[workelist]}];
Print["Energy levels missing:",
Length[lines] - Length[eigenvalues]]
This is what the diagram looks like for Coronene

3 hours later…
9:18 AM
@belisarius Yes, that one. It's the size of half a palm.

10:14 AM
I wonder why this answer of mine got a downvote.

10:55 AM
@Heike I just went through your answer. It is definitely different from the way I think about the problem, which is a good thing. It is good to know that we can use `Sow`/`Reap` in place of accumulator in the function definition. `TakeWith` is also very close to one of the functions I was looking for.
@Heike I was puzzled by the middle line `merge[list2_, list1_] /; crit[First[list1], First[list2]]` until I realized that `list1` and `list2` are switched! If it were me, I'd probably use `merge[list1_, list2_] /; !crit[First[list1], First[list2]]` instead.

11:33 AM
@MichaelWijaya I'll change that. That notation was left over from a previous version where I copied the code for the second case from the first case until I realised that I might as well just call the same function with the arguments swapped.
@MichaelWijaya I like using Sow/Reap. The second argument of Sow and second and third arguments of Reap make it very versatile and it allows me to not have to worry about keeping track of all the relevant bits until after they've all been sown.

2 hours later…
1:37 PM
Quick! Without executing, tell me what's the output of
m={{{a, b}, {c, c}}, {{d, e}, {c, c}}, {{h, i}, {c, c}}};
`m[[All, 1]][[1]]` and
`m[[All, 1, 1]]`

2:29 PM
@SjoerdCdeVries Errr .... 42?

@belisarius wrong, guess again

@SjoerdCdeVries That is the canonical answer for everything. It can't be wrong.

@SjoerdCdeVries The first was what I expected. It took me a while to figure out why the second bit gave the result it did.

@JM Pretty counterintuitive, isn't it?

@SjoerdCdeVries It made sense only after analysis and a thorough reading of `Part[]`'s docs.

2:33 PM
@SjoerdCdeVries When I started to program there was punched cards. I can't imagine myself programming in Mma with a compilation and running turn around time of one day.

@J.M This part of the syntax discription is actually a bit misleading:
expr[[i,j,...]] or Part[expr,i,j,...] is equivalent to expr[[i]][[j]]....

@SjoerdCdeVries Ah, that. A bit of a trap.
A related puzzle: what does `Transpose[m, {2, 1}][[All, 1, 1]]` return?

@belisarius while building mma expressions I start at the core with some test set and start building up while checking all the time whether the intermediate results are what I expect

@belisarius Programming was more a chore in the days of cards. Real-time made things much more fun.

@JM I don't touch Transpose's second argument with a stick

2:39 PM
@SjoerdCdeVries :D
I manage to imagine what it does for rank-3 tensors; any more dimensions, and it becomes a bit of a muddle for me.

@JM I had to cheat here. Couldn't do it off the top of my head

3:26 PM
@JM @Sjoerd Both gave the result I expected. I use this kind of indexing to slice high dimensional arrays all the time, so I'm quite used to it.
@JM I could never get fluent in the second argument of `Transpose` :-( I do need to use it occasionally, but I'm not fluent enough to get it right on first try ...

I won't call myself fluent either. :) As I said, it's clear up to rank 3. Rank 4 and above, I need a good amount of hand-holding...

@MrWizard Congrats! :-)
@JM How about the second argument of `Flatten`?

@Szabolcs: (P.S. You're using the Color Spiral thing now?)
@Szabolcs That's a bit nastier to untangle...

@JM Not yet, I actually came to this chatroom to sit down and fix up my figures, with the help of your colour links. Got a little distracted with `Transpose` and `Part` ...

3:45 PM

@Szabolcs how long before you get there?
btw, congrats @MrWizard :)

@rcollyer Thank you.
@Szabolcs Thank you.
@RM Thank you.
:-)

@RM I have barely answered recently. Haven't reached 200 in a long time. I need 4 more 200+ days.

@SjoerdCdeVries I've overlooked that in the documentation; indeed that is misleading and should be corrected!

@JM And here's the freely downloadable PDF, again, for those interested. (My uni account has expired :'-( )
@SjoerdCdeVries `All` is a bit special. All that is true for integer arguments only.

3:55 PM
@Szabolcs I haven't answered recently either... can't wait to get to 20k though

@RM I still have a number of old comments and posts to answer before I can start on new ones ... I got so lazy recently. One of them is your comment about changing syntax colouring info in embedded (as opposed to saved) stylesheets.

Hello CHM.

Hey @CHM
@MrWizard I voted for you there before I saw your message in here.

@Szabolcs I know the feeling. I've got a backlog of questions/answers I want to review about a mile long now.

@Szabolcs Oh that... I think what would be really useful is a "Embed all properties" or something like that. For example, if I have a custom styled notebook (using a stylesheet) that I give to someone else, they get an error when opening, saying file not found

3:59 PM
Hi @Szabolcs @MrWizard

the site also has a consistency in volume now that it's hard to keep track of questions

@RM THe site seems to be doing good!

i used to catch up on lull days, but now it seems impossible

But first things first ... let me fix up some figures with a new colour scheme, then I want to go make a time lapse of the sunset at Valletta's Grand Harbour :-) I found a little program that can control cameras from a laptop. Malta has WiFi in most parks, so I might be back if I don't need to save battery

There is a feature I would like to implement in Mathematica. I'll post a question, but first I want to make sure I'm not missing an easy solution (or, if there is a clever but easy one I'll post the question anyway so that it may be answered).

4:03 PM
not undo again! ;)

I want to create a new display type, especially for numbers (or text), but potentially for arbitrary objects as well. I want a "drag box" where not all of the number (object) is visible, but dragging left and right on the object itself slides it left and right (or in a generalized form both x and y). No scroll bars should be visible, and it should be tightly integrated much like `Framed` so that it can be used in different places without difficulty.
The closest functionality to this I am aware of is `Pane`, e.g.:
``` Pane[Style[N[E, 150], LineBreakWithin -> False],
ImageSize -> {200, 40}, Scrollbars -> {True, False}]```
Any ideas?

Food time. AFK

bye CHM
@Heike The downvote is not mine, but probably someone found it didn't work on their system, as I feared.
@JM Would you give an example of that in use, please?

Quick test: `Graphics[Raster[{Range[100]/100}, ColorFunction -> colorSpiral], AspectRatio -> 1/8, ImagePadding -> None, PlotRangePadding -> None]`
Then to check the grayscale version: `ColorConvert[%, GrayLevel]`
I used a slightly different (and simpler) windowing function from what McNames used, but the colors are more or less the same.

@MrWizard the linked article has an example
@JM I'm not so thrilled with black as the darkest colour

4:15 PM
@RM Yeah, I'd have taken a dark blue myself, but I'm still figuring out the colorspace math to adapt his idea properly.
(On a related note: there's an awful amount of MATLAB packages for color schemes...)

@MrWizard Unfinished, but something like this?
```DynamicModule[{ref = 0, x = 0, x0 = 0},
MouseAppearance[EventHandler[
Dynamic@Pane[
Pane[N[Pi, 100], 100000],
ImageSize -> 100, ScrollPosition -> {x, 0}
],
{"MouseDragged" :> (x =
x0 - (First@MousePosition["ScreenAbsolute"] - ref)),
"MouseDown" :> (ref = First@MousePosition["ScreenAbsolute"];
x0 = x;)}
], "FrameLRResize"]
]```

@Szabolcs That was fast. Other than `MouseAppearance` which does nothing in v7, YES. I'll post that question in a little while; for now I need food (echo CHM).

For those who haven't seen one of the important articles I was pointing Szabolcs to: jwave.vt.edu/~rkriz/Projects/create_color_table/color_07.pdf

@MrWizard It has many problems though: 1. the N[Pi,100] shouldn't be recalculated constantly. 2. I don't completely understand why Dynamic doesn't work inside the ScrollPosition setting (I though it did in the past, maybe I should use ScrollPosition -> Dynamic[...] instead of ScrollPosition -> {Dynamic[...], ...} --- this is just like a control, think e.g. Slider) 3. when the mouse leaves the region, it stops working, and for good usabillity it shouldn't
@JM I have an old and not very good screen (it takes a couple of seconds for the backlight to turn white now), but looking at that artcile's rainbow scale it seems to me that they have a series of narrow transitions and constant colours. The distinguishability is almost like a steps function. ColorData["Rainbow"] is better than that.

4:31 PM
@Szabolcs yeah, but "Rainbow" is not really a rainbow colour scheme. Neither is MATLAB's jet, which a lot of people clump with the rainbow scheme
I'm not defending either of them... I've been bitten several times before with jet artificially highlighting stuff that's irrelevant or tending to suppress structure that would've been visible in grayscale
However, I get dirty looks for using colourschemes other than jet. At best, a modified jet to adjust the zero crossing would be acceptable. Nearly every paper I've read uses jet/rainbow
So the author(s) is spot on when they talk about the prevalence of rainbow/jet in the engineering and science fields

@Szabolcs "a series of narrow transitions and constant colours." - "Mach bands", they're called.

@RM How would you define 'rainbow' then? I admit I only skimmed through the paper, but I didn't find a definition. I think this is a crucial point ...

I don't have any personal definitions... What I meant was that the paper uses what JM mentioned, whereas typical rainbow schemes interpolate linearly between violet and red

Hmmmm ... `DensityPlot[Exp[-(x^2 + y^2)], {x, -3, 3}, {y, -3, 3}, PlotRange -> All, PlotPoints -> 60, ColorFunction -> #] & /@ {GrayLevel, "Rainbow", "DarkRainbow", "GreenPinkTones", Hue}`

The thing I picked up was that the best "diverging" color schemes correspond to Mathematica's `"TemperatureMap"` and `"GreenPinkTones"`.

4:42 PM
@Szabolcs @mr.wizard I got this:
DynamicModule[
{delta = 0},
EventHandler[
Dynamic@Pane[Style[N[E, 150], LineBreakWithin -> False],
ImageSize -> {200, 40}, Scrollbars -> False,
ScrollPosition -> {delta, 0}], {"MouseDown" :> (mp =
MousePosition["CellContentsAbsolute"][[1]]),
"MouseDragged" :> (delta =
mp - MousePosition["CellContentsAbsolute"][[1]])}
]
]

(`"RedBlueTones"` was supposed to be an another one, but it looks too washed-out for me.)
@RM Like that?

@RM I'm reading it in detail now, I think they mean something like `Hue`. That is indeed quite awful for the reasons they say. I think `"Rainbow"` (which is quite different) is excellent for my application though. The purple-blue transition is just at the right place.
It's not convertible to greyscale though.

@Szabolcs FrameLRResize is a nice touch. Other than differnt coordinate systems our solutions are pretty much the same

That one's a "rainbow" scheme I've seen often in most other software.
(The Mathematica reproduction: `Graphics[Raster[{Range[100]/100}, ColorFunction -> (RGBColor[Sin[Pi (# + 4/15)]^2, Sin[Pi (# - 1/15)]^2, Sin[Pi (# + 3/5)]^2] &)], AspectRatio -> 1/8, ImagePadding -> None, PlotRangePadding -> None]`)

Are any of you colourblind?

4:54 PM
@Szabolcs Not me.

I had a friend who found out only during our conscription at the end of high school.

@JM yeah, similar to that

@JM Did you make the function "by feeling" only?

@Szabolcs Nope; I sampled their color schemes very finely and did a few nonlinear regressions.
@Szabolcs How? A test?

@SjoerdCdeVries In your `CurrentValue` question, if you include the other possible patterns for a `CurrentValue` call, you get some more. Try with `HoldPattern[CurrentValue[a_, b_]] :> {a, b}`

4:58 PM
@Szabolcs (That was also around the time I was looking at emulating the MATLAB color schemes a few months ago.)

You only need `b` (and filter dupes from that), but I included `a`, because they're associated with certain objects

@JM There used to be a compulsory conscription for all men at the end of high school, accompanied by a series of medical tests. They changed the law since then, so I never did my military service ... (not compulsory any more).

@RM Cheeky bastard. :)

@RM I saw we both jump on Mike's CurrentValue additions ;-)

5:01 PM
I'd suggest moving the latter half of your question (beginning with John Fultz' answer... ) into a CW answer so that additions found like this can be easily added

@RM I see that we have to delete the additions. They are already in the official doc page 8-O

The problem with this colour spiral is that is has very bad resolution close to the zero level (close to the blacks)
"Problem"---problem for my application

@RM HoldPattern[CurrentValue[a___]] :> {a} is better still

@Szabolcs You've tried tweaking the `p` parameter in the `colorSpiral[]` routine?

5:14 PM
I'm playing with it now
What I get doesn't look the same as what I see in the PDF though
Maybe some colour correction in the PDF?
This is the one from your pastebin
I have to go now or I'll miss the sunset
see you later!

See you!

@MrWizard I don't think it was that. I've got a pretty good idea who casted the down vote anyway, and why.

@Szabolcs Yeah, I changed the window function. Using the original triangular window give that thing in the PDF. I agree, the black region looks a tad too wide.

@JM heh, 1 and 2 are the only usable values of `p`

@RM Yeah, I checked just now. Converting to `GrayLevel` gave something jittery for somewhat large `p`.
I'm trying to look for a follow-up to that color spiral article if there's any improvements, but my Google-fu's failing me somewhat.

5:41 PM
@Szabolcs: if push comes to shove, you can try looking around this site for other color gradients.
With that, I gotta step out. See y'all later.

6:16 PM
@Heike why then?

@SjoerdCdeVries I'm not telling

2 hours later…
8:44 PM
My first try at shooting a time lapse:
The capturing program crashed in the middle, so there's a glitch there. I need to figure out how to do the metering correctly to avoid that very visible fluctuation when there's fireworks. Also, the frame rate could be double of what it is (this is 10 sec / image)
It's a shame I didn't catch an ocean liner. They usually come and go every day here.

9:01 PM
@Szabolcs just put it on manual exposure and set it to the appropriate value

@Szabolcs Is that the view from your home? If so I'm jealous.
BTW, what setup are you using?

@acl I can't do that ... it was getting dark and the shutter speed went from ~1/2000 to ~1/4 during shooting. Then the memroy card filled up (simply because I forgot to empty it before leaving---I set the resolution to a low value and saved as JPEG to make sure it won't take a lot of space).
@acl I guess it's tricky to get the metering right ... I think it'll be better to set it to centre-weighted or even spot metering for as long as the middle of the picture has a segment of the sky. Then hope they won't shoot a firework there or the cannon smoke won't be blown by the wind right under that spot :-)
@Heike It's not, I shot it from the wall in Valletta, the most fortified city I've ever seen. There was a small kiosk just next to this place, so I could even get a beer :-) and tourist don't often come to this part of Valletta, so it was pleasant and quiet. (It was shot from here: goo.gl/maps/sf6U )
@Heike Thanks to living on the top floor, I can see sort-of see a marina from our terrace, but the view is not that great: goo.gl/maps/2dZA
@Heike A Nikon D60, my old laptop (hoping not to run out of battery), and this: diyphotobits.com/download-diyphotobitscom-camera-control

9:18 PM
@Szabolcs It's probably miles better than my view anyway: an elderly home with a parking lot and a bus stop in front.

@acl But any advice about doing this is always welcome! I know you like photography. My plan is to hack on the camera control program a bit, look at this sequence I made today to get an idea about how the shutter speed should be adjusted, and write a program that adjusts the settings based on a pre-defined curve instead of using metering.
(that photo coming from this question )

@Szabolcs Looks interesting. I was playing with the thought of experimenting with time lapse myself. I have some software that came with my canon but that stopped working properly after the update to Lion. Apparently OS X comes with built in software to control a camera but I don't know how good that works.
@Szabolcs That's what I would do.
9 stops is a bit much but if the difference was less than about 2 stops I would just put it on a fixed manual setting.

@Szabolcs if there's no clouds, then the exposure for a sunlit (or moonlit) scene is fixed by the time of day so that should work. but I don't know how that would work with the change in balance between natural light (which decreases as night falls) and light from the electric lights (which is constant, once they're on)
also, could you not set it to take 3 bracketed shots each time? mine can do that (not that I've ever tried time lapse)

@acl bracketed means several shots with different exposures?
The program I used has support for that but I haven't tried it yet

@Szabolcs sorry, yes, that's what I meant. but with 9 stops difference you can't just use bracketing I guess

9:31 PM
Also I'm a bit worried about pushing it too much, especially considering that it's my gf's camera: the shutter life is said to be finite: diyphotobits.com/2010/01/23/…

@Szabolcs how many did you take for this video?

@Heike One problem is that the automation software is written in VBscript ... I'm wondering if I can use Mathematica for this. It's supposed to use Windows's standard image acquisition interface
@acl For this one, 212. But next time I want to shoot for a longer time (no more running out of storage space...) and I want to double the frame rate. That'd push it to between 500-1000.

@Szabolcs you could also use mathematica to programmatically reduce some patch in the sky to a fixed brightness for all frames

@Szabolcs VBscript? Is that combining all the good bits of javascript and Visual Basic?

With an estimated lifetime of 50,000 actuations this would allow shooting no more than 50 sequences ... so it's a one time game, just for fun and to learn a little :-)

9:36 PM
@Szabolcs ok that is a bit much. I am up to 50000-60000 with no problems yet, but at 1000 per video...
according to that site, mine has 40000 more...

@Heike Internet Explorer can execute both JavaScript and VBscript (Visual Basic). MS used to push VB as a web language. It's also one of the native languages of the Windows Scripting Host. I'm not too familiar with the technology. This program I used is written as a "HTML application", where the GUI is made with HTML and the scripting is--in this case--done using VBscript and an ActiveX control that gives access to image acquisition
I'm not very familiar with this (quite old) MS techonology

@Szabolcs Good luck with hacking that. I don't envy you ;-)

@Heike I think I'll try to use .NETLink with that image acquisition component to control the camera from Mma. If I manage to do that, it'll open up a whole new world. If I manage to retrieve the photos too, even better!

@Szabolcs I am still hoping to get Mathematica to control my camera directly. I'm on OS X which means no .netlink for me. I'll have to figure out how to do it in a different way.

10:44 PM
@OleksandrR, you around?

@Rojo yeah, just got back. Hi.

Hi there
@Rojo no, I haven't had much time lately for things like that. I just saw it was used in `FittedModel` but couldn't work out what the reason for it was. As Brett said, it can be used to localize `DownValues` rather than only `OwnValues`, so perhaps that's the reason for its existence. Other than that I'm still none the wiser.