Matthew Petroff Fri, 01 Mar 2019 00:16:29 +0000 en-US hourly 1 3D-Printed Tea Bag Holder Fri, 01 Mar 2019 00:16:29 +0000 Continue reading ]]> When readily available containers do not come in the desired form factor, 3D-printing can be quite useful. In this case, I wanted a tea bag holder that fit on a small ledge, allowed the tea bag labels to be read, and allowed the tea bags to be easily removed. Although there are some similar products available commercially that would fit the space, they either seemed a bit flimsy or looked to be a tight fit around the tea bags, which would make them more difficult to remove. Thus, I designed and 3D-printed a modular holder that can be stacked. The holder was printed out of PLA, and the design files are available.

Tea Bag Holder

]]> 3
Color Cycle Survey Fri, 07 Dec 2018 03:23:01 +0000 Continue reading ]]> A previous post about randomly generating color sets with a minimum perceptual distance addresses the technical aspects of generating sets of colors that are visually distinct for those with normal color vision as well as for those with color vision deficiencies. However, it does not address the aesthetic aspect, which I will start to address here. To create an aesthetically pleasing color cycle—an ordered set of colors for visualizing categorical data—two aspects need to be addressed, the colors that are used and the order that they are used in. While one could take an ontological approach to this by trying to define a set of rules that make a pleasing color cycle, as is done by I Want Hue,1 such a method is error-prone and substantially biased toward the personal preferences of the drafter of the rules. Instead of using ontologies, an alternative approach that is gaining traction in many fields is to infer a pattern from a large data set using machine learning techniques. This is the approach I wish to pursue.

To this end, I’ve created a Color Cycle Survey. After presenting the user with an introduction, colorblindness questionnaire, and directions, the primary survey starts. In it, the user is presented with two color sets and is asked to choose the one that is, in the user’s opinion, more aesthetically pleasing. Then, four orderings of the chosen set are displayed, and the user again makes a selection to taste. This basic process is then repeated again and again, with sets of either six, eight, or ten colors. For the choice of color set, each set is presented ordered by hue, since this makes the two sets easier to compare than if they were randomly ordered (or ordered by RGB values). Only two sets are presented, to make for an easier choice. Additionally, a line plot or scatter plot rendering is shown with each color set. For the choice of ordering, four orders are presented, since multiple orderings are easier to compare than sets, since the colors are all the same. I considered asking the user to order the colors to taste, instead of presenting possible orderings, but I decided that while such an approach yields more information per response, it takes much longer and requires more effort, so each user will likely respond many fewer times. Thus, I went with the simpler approach.

If all goes well, I’ll amass a sizable data set from the survey, which will remain available for at least a few months. Once I have data to experiment with, I’ll work out the exact analysis method. In addition to generating an “optimal” color cycle, it would also be interesting to create a model that allows for additional constraints, such as being able to choose the first color or being able to choose the exact number of colors in the cycle. Once anonymized, I’ll release the survey data under a permissive license, probably CC BY 4.0 (I’m open to suggestions). Any generated color cycles will be release into the public domain via the CC0 public domain dedication.

  1. I Want Hue takes a fairly rudimentary approach to color vision deficiency simulation, which I find lacking; I personally have difficulty differentiating colors in the many of the sets it generates, even when its colorblind mode is turned on. It also doesn’t really address the ordering of the color set into a cycle.  

]]> 2
Randomly Generating Color Sets with a Minimum Perceptual Distance Sat, 27 Oct 2018 16:14:11 +0000 Continue reading ]]> Earlier this year, I released a color cycle picker that enforces a minimum perceptual distance between colors, including color vision deficiency simulations, with the goal of creating a better color cycle to replace the “category 10” color palette used by default in Matplotlib, along with other data visualization packages. While the picker works well for what it was designed for—allowing a user to create a color cycle—it requires user intervention to create color sets or cycles.1 The basic technique used—performing color vision deficiency simulations2 for various types of deficiencies and enforcing a minimum perceptual difference for the simulated colors using the CAM02-UCS3 perceptually uniform color space (where each type of deficiency is treated separately) and a minimum lightness distance (for grayscale)—is still valid for the random generation of color sets; it just needs to be extended to randomly sample the color space.

To randomly sample the available RGB color space, I started with the excellent Colorspacious Python library, which is capable of doing the requisite color vision deficiency simulations and perceptual distance calculations. However, it’s too slow for what I wanted to accomplish. Thus, I stripped the library down to the bare essentials and optimized it with the Numba JIT compiler. Since RGB to CAM02-UCS conversions are computationally expensive, but the 16.8 million possible 8-bit RGB colors easily fit in memory, the CAM02-UCS colors are precomputed for every possible color, both for normal color vision and the three types of color vision deficiency. Since very dark and very light colors are poor choices for data visualization, only colors with J \in [40, 90] are used, leaving 13.1 million colors to sample from.

To generate a color set, a starting color is chosen at random. Then, each possible color is check to see if it is far enough away in both lightness and perceptual distance, both for normal color vision and for those with color vision deficiency, at the maximum chosen color vision deficiency severity. Of these remaining colors, one is chosen at random. The process is then repeated until the color set contains the desired number of colors. This method has an advantage over rejection sampling, since it is guaranteed to return and was found to be faster. After the color set is generated, it is checked at intermediate levels of color vision deficiency severity to ensure that the minimum perceptual distance requirement is met there as well; it the distance requirement is not met, the color set is thrown out. Checking a coarse color vision deficiency interval during set generation was tried but removed, since the performance penalty outweighs the gains from having to try again fewer times. With this method in place, it is now possible to randomly generate color sets of various sizes that meets various minimum perceptual distance and minimum lightness distance requirements. However, substantial computational resources required to generate a large number of color sets.

Using this code, I’ve generated six, eight, and ten color sets with what I think are reasonable minimum perceptual and lightness distances, where reasonable means that the colors are easy enough to tell apart while still allowing a reasonably large range of different colors to be used. Full deuteranopia, protanopia, and tritanopia simulations were used. For each configuration, 10 000 random sets were generated on a 28-core machine, a process that took from around nine hours for the six color configuration to around three days for the ten color configuration. The code and generated color sets are available in a repository on GitHub.

While the individual colors in the color sets are easy enough to tell apart, the colors and their combinations are not necessarily aesthetically pleasing. I’m currently working on something to address this shortcoming; details will follow in a subsequent blog post.

  1. A color set doesn’t have a defined order, while a color cycle does. 

  2. G. M. Machado, M. M. Oliveira, and L. A. F. Fernandes, “A Physiologically-based Model for Simulation of Color Vision Deficiency,” in IEEE Transactions on Visualization and Computer Graphics, vol. 15, no. 6, pp. 1291-1298, Nov.-Dec. 2009. doi:10.1109/TVCG.2009.113  

  3. Luo M.R., Li C. (2013) CIECAM02 and Its Recent Developments. In: Fernandez-Maloigne C. (eds) Advanced Color Image Processing and Analysis. Springer, New York, NY. doi:10.1007/978-1-4419-6190-7_2  

]]> 0
3D-Printed Hilbert Curve Absorbers Sat, 11 Aug 2018 22:21:21 +0000 Continue reading ]]> Fused filament fabrication (FFF) 3D printers are good for many things,1 but production of sharp points is not among those strengths. Thus, the traditional structure of millimeter wave absorbers—a periodic array of square pyramids—is poorly suited for production via FFF printers. Millimeter wave absorbers serve a crucial role in Cosmic Microwave Background (CMB) telescopes by terminating stray light, which is necessary for reducing systematic errors. Not only are the points difficult to produce; they’re also fragile, since a print is generally weakest along its layer lines. Thus, a new geometry was needed, as is detailed in my paper titled A 3D-printed broadband millimeter wave absorber.

Space-filling curves such as the Hilbert curve completely fill the unit square. Furthermore, the Hilbert curve can be described by a sequence of physically realizable geometric approximations. Tracing a wedge along such an approximation creates a geometry with similar optical properties as a pyramidal array but with enhanced mechanical robustness. Importantly, this geometry can be printed without repeatedly starting and stopping extrusion, making it well suited for FFF printers.

Hilbert Curve Absorber (Detail)

Hilbert Curve Absorber

When such a geometry is printed out of a carbon-loaded plastic, it makes a reasonably effective millimeter wave absorber. A prototype was manufactured out of a conductive HIPS filament2 and was measured to have sub-percent reflection in the frequency range 63–215 GHz. Proto-pasta’s off-the-shelf Conductive PLA filament also works to an extent, but it’s too conductive for this use, which results in increased reflection. When printing the bottom layers of the model, aligning the fill lines with the sides of the square instead of on the diagonal seems to make the print less likely to prematurely peel off of the print bed. For the HIPS, using a higher bed temperature for the bottom layer may also help, but if too high a bed temperature is maintained for the rest of the print, the print ends up with some undesirable waviness in the wedge cross section.

The Hilbert curve is not the only space-filling curve that works in this application. The 37a-1 generalized Gosper curve,3 which roughly fills a regular hexagon, was also prototyped, as it can more easily tile the interior of a circle. Various other space-filling curves, such as the Peano curve, could work in some applications, but they may not have a uniform polarization response, an important property of absorbers used in polarization-sensitive CMB instruments.

The code for producing the Hilbert curve geometry was written using CadQuery. The code and resulting solid models are available from DOI:10.5281/zenodo.1322839. See the paper, arXiv:1808.00820, for more details.

37a-1 Gosper Curve Absorber

37a-1 Gosper Curve Absorber (Detail)

  1. A LulzBot TAZ 6, in this case. 

  2. PS-715 from Modern Dispersions, Inc. 

  3. Fukuda, Hiroshi, Michio Shimizu, and Gisaku Nakamura. “New Gosper space filling curves.” In Proceedings of the International Conference on Computer Graphics and Imaging (CGIM2001), vol. 34, p. 34–38. 2001. 

]]> 1
Geysers del Tatio Sat, 30 Jun 2018 20:58:47 +0000 Continue reading ]]> I recently returned from a couple months working in Chile. While there, I finally made it out to see the El Tatio geyser field, which is the third largest geyser field in the world. The geysers are around an 80 km, hour and a quarter drive north of San Pedro de Atacama and are normally seen just before sunrise. Some photos I took are below.

Geyser Field


Geyser Field

Geyser Field

Geyser Field

Geyser Field

]]> 0