Home
David Gowers [entries|archive|friends|userinfo]
David Gowers

[ website | my technical journal ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Use the right tense! [Oct. 28th, 2009|04:50 pm]
[Tags|]

An important part of taking responsibility for yourself and understanding yourself is
to use the right tense.

For example..
I was recently writing a caption for a photo and I had written 'I feel nervous about photographing people'.
I went back and changed it to 'I felt nervous about photographing people'. Thinking about the truth
versus how you may like to excuse yourself like this helps free you from outdated beliefs you've had
about yourself and deal more flexibly and honestly with the real situation.

Right now, you have a choice what to believe of yourself,
which controls what things you will allow yourself to do (and how). But!
You can only see and use that choice optimally if you leave the past in the past,
the future in the future and pay attention to what is needed now.

If you like this post, go look up information on Cognitive Dissonance (and hopefully talk with someone
intelligent to clarify your understanding. Commenting here is okay for that purpose too.). It's a powerful
way of understanding habits, their essential irrationality, how we develop and change them,
but especially as a way to understand cause and effect upon human cognition.
linkpost comment

Building a better generic 256-color palette than the ubiquitous 'web palette' [Oct. 16th, 2009|10:56 pm]
[Tags|, ]

In the last week, I've been experimenting with making a better 'generic 256color palette'.
Classically such palettes have been based on the websafe 8R*8G*4B quantized RGB colorspace,
or on the 6R*7G*6B variant (with 3 entries to spare).

I believe a generic palette should provide a rich and suggestive set of colors, with the ability to
create believable gradients between any colors which are fairly different in brightness.
Both of the existing palettes I found unsatisfying -- sickly, excessively dark and saturated, and
incapable of comfortably expressing many of the most interesting possible types of color transition.

While the sRGB system is an effective image encoding, the difference between colors in RGB space is
not very accurate to the difference perceivable by human eye.
Distance between values in CIE LAB color space are much more true to human perception differences.

Therefore, I started by generating a (256, 256, 256) 3d image of the LAB colorspace,
where one of L,A,B varied across a particular dimension. The standard measurement of the A and B
color components is on the range [-128..128], whereas L ranged from [0..100]. This had consequences later
when generating the quantized palette. This was very easy with numpy:

def assign (arr):
    "Fill a (256, 256, 256) array with gradients of LAB values, varying along the appropriate axes"
    lgradient = np.linspace (0, 100, 256)
    abgradient = np.linspace (-128, 128, 256)
    arr[..., 0] = lgradient
    abgradient.shape = (256, 1)
    arr[..., 1] = abgradient
    abgradient.shape = (256, 1, 1)
    arr[..., 2] = abgradient



Next I checked which of those 16.7 million LAB colors I generated were actually displayable
sRGB colors -- about 2.075 million, and saved a file containing the values of that subset using
np.save(np.save('labmasked.npy', arr[mask])
.
I also saved the values of this 1d image converted to sRGB (the conversion is QUITE slow).

Now I chose to use scipy's "k-means" functionality to quantize the result into
256 colors -- this is found in the package
scipy.cluster.vq
. I wrote a little
program that loads the relevant data (including the last best-guess at the palette,
and does a small number of k-means iterations (which iteratively approximate the ideal quantization).
The
kmeans
function returns a distortion value which gives a good idea of how much difference
there is between the ideal and the actual colorset you got.
I decided that it was okay once it reached 0.25 (running k-means on a dataset of 2 million items is SLOW)

I converted the result to sRGB, sorted it by L-value (perceived brightness) and saved it into a PNG
using PIL. Looking at this, it seemed to have an excellent distribution of colors; experiments with Grafx2's
translucent drawing confirmed it. However! the difference between the gamut of the L channel and
the AB channels seemed to produce a preference for range in hue over range in saturation.


Here it is.

palette arrangement sketch

I fixed the aforementioned problem by normalizing a+b to span -+50, and got this
adjusted palette

refined into these:
(always remember to whiten the observation data first!
Otherwise the results are rather poor! -- the initial run of k-means is slower than subsequent runs,
and wasted 40 minutes because I forgot to whiten the data (with vq.whiten.. which essentially just
divides the data by it's standard deviation (independently for each channel))

Trying again at 10:28, finished at 11:36 (1 hour, 8 minutes elapsed)

While I was waiting, I had an idea for how to auto-pick a pair of good dithering colors to represent
another color.


1. represent all colors in LCH space
2. precalculate the distance between the target color and each possible result color.
3. While all results are (the same, or both colors in each pair are the same as each other):
4. Pick a L line to fit (based on even distance from the target color -- eg L 50 -> line is 45..55)
later iterations should expand the length of the line.
5. Pick a radius (for the C channel). increase the radius on later iterations
6. Iterate over 6 angle (H) pairs -- H1 = target_H + offset, H@ = target_H - offset
7. Match the ideal colors to the available actual colors
8. Lookup these colors in the distance table to calculate a 'well-fittedness' value for each.
the most well-fitted pair of colors have distances that exactly cancel out (average ==0),
and those distances are minimal.

try 3


by iterating the color table with k-means.
I eventually realized that pure grays were getting left out because they weren't in the input observations..
I should have used the range -127 .. +128 so that exactly 0 (neutral) was an option for A and B

It might be wiser to create a 254-color palette and force the addition of pure black and white.
Also, treating RGB as if it were VGA (64 levels of intensity -> 262144 possible colors) might help.

I just had the idea to create an amiga colorprofile image (containing all 4096 colors in amiga colorspace)
and get the user to manipulate this image to represent the colorset they want to achieve an optimized match
to.

Putting that aside..
Various experiments later, I resolved to create a 254-color quantized palette based on the 262144 VGA colors.
The much smaller dataset means that k-means executes much quicker...
So, I was able to eventually reach a near-ideal colorset, getting the distortion down to
0.20022496, where it has remained for the last 96 iterations of k-means.
I add the black and white colors in afterwards, which makes it up to 256 colors.

Here it is with some testing color gradients using those colors below it.
James Paige mentioned he'd really prefer a palette made up of 8-color gradients rather than
the typical 16, so I was curious whether this was doable without palette customization.
Looks like the answer is yes (though I suspect the actual arrangement of the palette
would need to be computer-aided in order to complete a full balanced set of 32 8-color gradients in
reasonable time.)

try 4

I'd like to generate a .. 384? 400? color set later, for drawing. This one is far far better than the web palette
already, but misses some very intense colors (reddened skin, luminescent sky-blue, really fiery yellow, bright magenta),
a larger palette should fix this to some degree... one inherent weakness of the k-means method is that it picks centroids,
meaning that the there are colors near the edge of the gamut, but not actually any on the edge -- hence the
lack of very saturated colors. I suspect a hybrid approach may be called for.

doing the quantization in LCH space might also help to address this..
anyhow there you go, this little palette is done,
I'm quite satisfied with it, as it decisively destroys web-palette in 90% of benchmarks.

If you intend to try out quantizing with this palette, I recommend GIMP as it seems to match colors with the
best accuracy.
linkpost comment

I'm merging dgowers_art and dgowers_tech into this journal. [Oct. 14th, 2009|05:37 pm]
[Tags|, , ]

Not directly -- that is, they will still exist, I won't copy any of the entries across, however I will put new artistic or technical things here (with appropriate tagging)
linkpost comment

shamelessness [Oct. 10th, 2009|12:22 pm]
[Tags|, , ]
[Current Location |Grafx2]
[It is |Well, its good to post these thoughts somewhere. Even though I mostly ignore LJ.]

I used to believe shamelessness meant just not regretting anything you had done
or are doing (no shame for the past or present).
But, it's not just that. It's also not cringing from doing things because 'that would
look stupid' or 'it would annoy people' or 'people would find it confronting'
or 'that would be scary'--
these are NOT rational objections because looking stupid, annoying people,
confronting people, or feeling afraid renders NO HARM to anyone. It's only when
one develops a habit of frequently annoying or confronting a specific person, or of terrifying yourself that it can do damage worth considering.

A rational shameless person is good at saying 'yes' to themselves whenever
the likely consequences are 'no real harm' or better.. even if they feel
conflicted about it, if they know they would like to do it and it's in fact
harmless, IT'S AS GOOD AS DONE. Which covers a lot of
territory and practicing it keeps your mind freer.
No shame for the past, present, or future.
link6 comments|post comment

Some stuff that has been sitting here for a while [Apr. 28th, 2009|03:04 pm]
..waiting to be posted.

---
(an article taken from my offline notebook)

Laziness is just a way of making more work for your self. At the least, it is a misunderstanding of efficiency - efficiency is not to employ the least effort to gain the greatest effect, but to aim for the greatest effect and spend an amount of effort that neatly achieves that effect.
If you phrase it the second way, you are not prone to thinking of 'what is the minimum effort' first and fitting your goal to that, rather it promotes thinking of goals first. Otherwise, the amount of effort you put forth tends to become a compromise between greatest effect and least effort (ie. becomes inefficient)

EDIT: TMC brought it to my attention that I posted this before. In that case, please ignore the above part. I did not mean to rapli mi valsi.

---
(newer)
I'm on Facebook now!
and twitter, where I'm posting about lojban currently
aaaand DeviantArt! There's even some new artworks there!

I've been doing some digital painting using MyPaint! It's hugely fun! :)

link2 comments|post comment

Laziness and Efficiency [Jul. 21st, 2007|07:33 pm]
[Tags|]

(an article taken from my offline notebook)

Laziness is just a way of making more work for your self. At the least, it is a misunderstanding of efficiency - efficiency is not to employ the least effort to gain the greatest effect, but to aim for the greatest effect and spend an amount of effort that neatly achieves that effect.
If you phrase it the second way, you are not prone to thinking of 'what is the minimum effort' first and fitting your goal to that, rather it promotes thinking of goals first. Otherwise, the amount of effort you put forth tends to become a compromise between greatest effect and least effort (ie. becomes inefficient)

Why should you consistently aim for the greatest effect, when this may increase a lot the amount of effort required? Because actions are largely gambles, and a very sound principle in gambling is to, if betting at all, always increase the amount of your bet. Mathematically, assuming that the return from a successful endeavour is worth more than 1.0x the value of the effort put into it, increasing the amount of effort will consistently compensate for any earlier failed tries, both numerically in value, and in feeling. The only necessary guarding principle is efficiency (eg. it is not efficient to put forth more effort than your body can safely withstand)
link4 comments|post comment

this is complete genius. [Jun. 2nd, 2007|01:03 am]
"In the Beginning was the Commandline."
as far as I have read yet, it looks like a history of User Interfaces.
Read it! Even if only for the brilliant and hilarious way of saying things:

" When Ronald Reagan was a radio announcer, he used to call baseball games by reading the terse descriptions that trickled in over the telegraph wire and were printed out on a paper tape. He would sit there, all by himself in a padded room with a microphone, and the paper tape would eke out of the machine and crawl over the palm of his hand printed with cryptic abbreviations. If the count went to three and two, Reagan would describe the scene as he saw it in his mind's eye: "The brawny left-hander steps out of the batter's box to wipe the sweat from his brow. The umpire steps forward to sweep the dirt from home plate." and so on. When the cryptogram on the paper tape announced a base hit, he would whack the edge of the table with a pencil, creating a little sound effect, and describe the arc of the ball as if he could actually see it. His listeners, many of whom presumably thought that Reagan was actually at the ballpark watching the game, would reconstruct the scene in their minds according to his descriptions.

This is exactly how the World Wide Web works: the HTML files are the pithy description on the paper tape, and your Web browser is Ronald Reagan. The same is true of Graphical User Interfaces in general. "

http://artlung.com/smorgasborg/C_R_Y_P_T_O_N_O_M_I_C_O_N.shtml
link1 comment|post comment

quote on Python's way of facilitating learning. [Jun. 1st, 2007|11:27 am]
[Tags|, ]

"I would like to venture an alternative explanation (inspired to some extent by comments from
Kirby Urner and from Ian Bicking about how Python relates to object-oriented programming). That Python is arguably the best language for beginners and arguably the best main language for professionals is neither a coincidence nor a remarkable achievement. The properties that make
Python uniquely powerful arise from its being codesigned as a language of learning and a language of production simultaneously and at its roots.

It's the quiet power of Python that makes it such a revelation to those of us who discover it after years of struggling with less expressive languages. I don't know if any of the core group has ever expressed what makes something Pythonic (except, perhaps, in cryptic zen terms), but I suggest it is that the power of Python is there when you need it and stays out of your way when you don't need it. Pythonic code then is code which is in keeping with this principle.

The positive consequences of this aesthetic seem to the Python devotee to be stunningly vast.
Some of them reflect directly onto beginners. Consider that expert code in Python is
indistinguishable from beginner code in those cases when the expert is doing something a
beginner might do. The amount of unlearning required to become expert in Python is very small,
and the amount of incomprehensible baggage required to start is zero. In other words, Python avoids disrespecting beginners with ugly and tedious compromises, and leaves a clear path to
the study of logical and algorithmic thinking, minimally burdened by arbitrary syntax.
"
-- http://pythonpapers.cgpublisher.com/ volume 2 issue 2, 'Python in Education'

Apparently Python was originally developed with the express purpose of making programming something that everyone can and will do some of. It is well on the way to achieving this. A world in which most people have at least somewhat robust logic skills is a goal that I applaud.
linkpost comment

(no subject) [May. 9th, 2007|12:07 am]
I just rode 50km in the last two days (back two), with no recent bike riding beforehand. It was a thorough explanation of the phrase 'got a second wind' -- in those terms, I must have reached my 6th wind. 25km there, 25km back: caught the train to Noarlunga Station and rode to Willunga. Great, that it reminded me of my capacity. The more abstract accomplishments are, the harder I find it to keep them in mind, so I have decided that physical accomplishments are needed on a regular basis. Anaerobic exercise also boosts the circulation a lot, which is very useful also for clarity of thought.

In short, workouts are for maintaining awareness of your true power, keeping puny considerations in their proper places, and maintaining a basically sound methodology.
link3 comments|post comment

(no subject) [Apr. 25th, 2007|06:41 pm]
You think leading to action leading to emotion leading to thought leading to..
I've determined this as the appropriate order, based on the following criteria:
* Action should definitely be the second item, because premeditation and postmeditation are both needed to maintain an accurate working view of the situation.
* Thought precedes emotion because I've observed that it literally cannot come after; Changing your thoughts changes your emotional responses, and if thoughts didn't come first, then all emotions would inevitably result in a feedback loop of emotion. Since feedback loops only happen sometimes, the converse is more likely (especially given that you can alter your emotional course by altering the course of your thoughts)
Ideally, each thought would lead to a matching action and emotion; This would be the definition of maximum learning potential. Each missed action reduces learning potential.

Will is the ratio between total number of thoughts and total number of actions.
The percentage between total number of actions and number of emotional responses that you detect* probably corresponds to your emotional fortitude.

* Distinct from the amount of emotional responses you actually have. Having more emotional responses than the total of actions implies dreaminess/sentimentality -- wasted thoughts; A deficit in detected emotions probably indicates emotional repression (to be precise, you do not express your emotions enough, and thus they can hide in the crevices of your mind.)
linkpost comment

Worth reading! On value, meaning, and methods of education [Apr. 16th, 2007|03:44 pm]
http://en.wikisource.org/wiki/My_Pedagogic_Creed
by John Dewey (there should be an attribution in the article, but I haven't found it.)

I was writing on a related subject; that's not finished yet; but here's an interesting two quotes from the linked article:


* I believe that interests are the signs and symptoms of growing power. I believe that they represent dawning capacities. Accordingly the constant and careful observation of interests is of the utmost importance for the educator.

* I believe that these interests are to be observed as showing the state of development which the child has reached.

* I believe that the prophesy the stage upon which he is about to enter.

* I believe that only through the continual and sympathetic observation of childhood's interests can the adult enter into the child's life and see what it is ready for, and upon what material it could work most readily and fruitfully.

* I believe that these interests are neither to be humored nor repressed. To repress interest is to substitute the adult for the child, and so to weaken intellectual curiosity and alertness, to suppress initiative, and to deaden interest. To humor the interests is to substitute the transient for the permanent. The interest is always the sign of some power below; the important thing is to discover this power. To humor the interest is to fail to penetrate below the surface and its sure result is to substitute caprice and whim for genuine interest.





* I believe that the emotions are the reflex of actions.

* I believe that to endeavor to stimulate or arouse the emotions apart from their corresponding activities, is to introduce an unhealthy and morbid state of mind.

* I believe that if we can only secure right habits of action and thought, with reference to the good, the true, and the beautiful, the emotions will for the most part take care of themselves.

* I believe that next to deadness and dullness, formalism and routine, our education is threatened with no greater evil than sentimentalism.

* I believe that this sentimentalism is the necessary result of the attempt to divorce feeling from action.


These two quotes are ones I completely agree with. And I'd like to also mention that hysterical fits are also sentimentalism, although typically sentimentalism is considered as a more sedate over-expression (or pretentious expression) of emotion. To precisely cover both, sentimentalism is emotional slobbery.
link3 comments|post comment

Expectation of competence [Mar. 27th, 2007|09:48 pm]
The way to answer the question 'Will I be any good at this?' is to ask, 'Is this simple, or complex?'. Then you may say certainly, whether a thing is easy or hard - meaning how much effort over time it will take -, if it is simple and you work at it, you will be good at it. And most things are simple -- complications are mostly invented, a natural learning path is possible for most things, where you simply notice the most salient element, address it and learn about it, and repeat.
linkpost comment

How to install GIMP on windows with Python support! [Dec. 16th, 2006|11:32 am]
[Tags|]

http://dgowers-tech.livejournal.com/4494.html

A notification for anyone who is interested in PyGimp in general or my GIMP plugins in particular. Including a screenshot I made myself, to demonstrate that I did it successfully.
linkpost comment

note: [Nov. 6th, 2006|02:29 pm]
My art journal ( [info]dgowers_art ) is finally seeing some activity.
I have decided it shall show the progress of each piece, so the likeness to a journal is close.
I try to be more expressive of my thoughts and feelings on my art; there are both subjective and objective impressions included, which I rank as an improvement.
At the time of this posting, the latest image is 'Photosynthesis' and is still in progress. It is a tilemap-based image, though that may be far from obvious, using a semi-unified 18color palette.I enjoyed the graphics of Flink and the graphics of Hocus Pocus, and this is inspired by those two, as well as my numerous technical investigations and love of the virtue of strangeness.
linkpost comment

zoom demo -- (topic -- UI design) [Oct. 26th, 2006|12:43 pm]
http://rchi.raskincenter.org/index.php?title=Demos
Fascinating work on UI design -- I post this particularly to highlight the Zoom demo, illustrating that instead of having links to other documents, you should be able to zoom in on a spot in the current document where the other document sits. It is far superior to links.
linkpost comment

decisiveness [Sep. 26th, 2006|06:27 pm]
Decisiveness is a key part of concentration. Concentration is a decision to ignore all other aspects of life in preference of one specific aspect, for the chosen length of time.
Indecisiveness therefore implies an inability to concentrate. Be decisive at all times.
link1 comment|post comment

a good thought about ill thought [Sep. 9th, 2006|09:25 pm]
[Tags|]

How to treat criticism and doubt, courtesy of my art ideas archive, dramatized as needed:
"It would cost more than my life is worth to bow to any criticism or ill thought, no matter how fell."

In my method, the way is to examine your thoughts and actions for any slavery of any kind, and kill it; to stand straight and tall.
Doubt and ill thought is regarded as dead. Criticism is regarded as an itch which can display its own importance over time, rather than pressing me to decide its import immediately.

linkpost comment

endurance decreases twitchiness [Jul. 21st, 2006|08:10 pm]
I have a new userpic finally! (see http://www.pixeljoint.com/pixelart/13167.htm for details -- you might like to reuse the palette because of its special properties)

I've been training on the basis of this hypothesis, and it definitely works -- I have more energy and less 'nervous energy'. I've been training daily for weeks now, but endurance training I only began in the last week. In the last three days, the time i can sustain a workout for has risen to half an hour, doubling every day. My ability to keep at a task has increased corresponding to my decrease in nervous energy.

Also if you're planning on training yourself, train your abdominals and lower your centre of gravity first -- these are the keys to agility and balance.

I've managed to do something that I haven't ever seen in a parkour video -- The simplest summary I can make is 'a vertical roundhouse kick' -- so instead of your body being vertical as your leg traverses the horizontal axis, your body is horizontal while your legs traverse the vertical axis.
It's probably the easiest way to traverse guardrails, if there is a wall nearby.
You run at the rail (~25degree angle?), grab the rail, and kick up, describing an arc of 180 degrees -- at the centre of the arc you bounce off the wall and boost your turning speed. At that point your body should be at a 30 degree angle to the ground (other degrees work too but that works best so far). When you learn how to get enough torque you can do upto 360 degrees (360 is the best for flowing continuation since you end up pointed in the same direction.)

Finally, you could also try my trick where I grab the rail and stand on the wall, then step off the wall onto the rail and jump off the rail in one motion.
linkpost comment

in reply to rinku's link-entry on fanfiction [Jul. 4th, 2006|11:14 am]
[Tags|]

rplying to entry: http://rinku.livejournal.com/1096603.html

Fanfiction functions the same as fanart -- experimentation. It's just like drawing a character in a different situation or with a changed aspect. It's not necessarily good writing, just necessarily fun. And if it is sufficiently like fanart, then creating some amount of it is beneficial to your ability in original art -- both editing and selectively copying give you insight into the construction of the original work.)
I agree that mostly or entirely it shouldn't be released, for the same reason I don't show off code that is just playing around or minor tweaks of existing code, only serious code.

-- I have a lot more potential entries in my notebooks ('note' has progressed a lot since I wrote about it in my technical journal. And I currently have 133k of / 228 notes in 32 notebooks). Mostly I'm too busy to actually amalgamate them and stick them here.
linkpost comment

Urban fitness training #AA [Jun. 7th, 2006|10:01 pm]
[Tags|]

This (and the associated entries that will follow) were made with my 'note' application, a simple program to
compile, edit, and otherwise manipulate collections of plain text notes (known informally as notebooks)
from the commandline.
It is simple to use ('note SUBJECT' such as 'note tech' to add a new note, it will tell you the ID code
as you finish making the entry), and I shall be writing more about it in my technical journal.



Find an l-shaped piece of guardrail (preferably within legs-reach of the ground):

1
+-
|
|2
|

Grip near the corner(1) with your shoes or feet, your body should be balanced along (2)
with your spine lined up with the handrail. Having a vertical support near your hands
helps, though it can be done without. I recommend with a handrail first, as it makes
learning how to mount the guardrail easier. Thicker guardrail is easier, until it gets too
big to fit the indentation of your spinal column.

Later, try the exercise on a chain link fence (the kind that has brackets holding the top
in place -- the type without brackets may not be secure).

Improves: balance, abdominals, fine muscle control, awareness, calmness
linkpost comment

navigation
[ viewing | most recent entries ]
[ go | earlier ]

Advertisement