In the introduction to the previous post I said:

And, for fun, I decided to look at removing any symmetry or asymmetry.

Can’t say I will actually accomplish that. But, let’s have a look.

Reduce Symmetry I

Well, I’d like to completely eliminate it. But, much too lazy to try that. Instead I am going to use the code from the last post to add another symmetry approach. In this case the function, get_sym_curve(f_x, typ_s, rwr=[], rwu=[]), will be passed two arrays of 8 integers each. The integers must be in the range 0-15 and there can be no duplicates.

The function will then generate a data row with sixteenths in rwr reversed and those in rwu not reversed. The sixteenths will be plotted as ordered in the two array parameters. Since the function will be called numerous times I can not generate the lists inside that function as they would change each time. Which is why I am passing them in. (Well there might be away to prevent that, but I personally don’t know how.)

I added the following to the function:

  elif typ_s == 11:
    r_x = []
    for rn in rwr:
      if rn == 0:
        r_x.extend(f_x[:s16[0]][::-1])
      elif rn == 15:
        r_x.extend(f_x[s16[14]:][::-1])
      else:
        r_x.extend(f_x[s16[rn-1]:s16[rn]][::-1])
    for rn in rwu:
      if rn == 0:
        r_x.extend(f_x[:s16[0]])
      elif rn == 15:
        r_x.extend(f_x[s16[14]:])
      else:
        r_x.extend(f_x[s16[rn-1]:s16[rn]])

In the function get_gnarly_dset() I added code to create the two arrays, before I iterate over the data set converting the rows using get_sym_curve. Which in this case may be a bit of a misnomer.

  if do_sym and s_typ == 11:
    # random selection of 8 sixteenths reversed
    r_nx = list(range(0, 16))
    rwr = np.random.choice(r_nx, size=8, replace=False)
    t_1 = set(r_nx)
    t_2 = set(rwr)
    rwu = list(t_1 - t_2)
    print(f"sym 11: reverse: {rwr}, unchanged: {rwu}")
  else:
    rwr = []
    rwu = []

Now, it would strike me as pretty clear that if we also modify the x dataset in the same way as the y dataset nothing much is really going to change. So, I am going to start by leaving the x data unchanged. That should make sure the the y data are not plotted in the same location as the original drawing (reversed or otherwise.) We’ll see how that works. I may also try using a different set of arrays for the x and y datasets.

Examples

As for most of the last few posts, I will show the untouched image followed by the augmented image(s). Will try to get a couple of good ones, but…

I am going to show the untouched image, the attempt at improving symmetry and the attempt at increasing chaos. So beware, there are going to be a lot of images.

  1. Simulated curve with cycling line width using scatter plot, single random shape. Wheels: 9 (Tetracuspid). 1024 plotting points.
spiro image comparing various attempts at obtaining or removing symmetry
number of cycles: 8, max marker size: 1472, untouched
spiro image comparing various attempts at obtaining or removing symmetry
number of cycles: 8, max marker size: 1472, attempt at symmetry
spiro image comparing various attempts at obtaining or removing symmetry
number of cycles: 8, max marker size: 4480, attempt at chaos
  1. Simulated curve with cycling line width using scatter plot, random shape for each wheel. Wheels: 7 (’e’, ’t’, ’t’, ’e’, ’t’, ’s’, ‘r’). 1024 data points.
spiro image comparing various attempts at obtaining or removing symmetry
number of cycles: 4, max marker size: 7424, untouched
spiro image comparing various attempts at obtaining or removing symmetry
number of cycles: 4, max marker size: 9472, attempt at symmetry
spiro image comparing various attempts at obtaining or removing symmetry
number of cycles: 4, max marker size: 8448, attempt at chaos
  1. Simulated curve with cycling line width using scatter plot, single random wheel shape, random marker shape. Wheels: 10 (Tetracuspid). 1024 data points.
spiro image comparing various attempts at obtaining or removing symmetry
number of cycles: 8, max marker size: 8448, m1: 2, untouched
spiro image comparing various attempts at obtaining or removing symmetry
number of cycles: 8, max marker size: 6464, m1: H, attempt at symmetry
spiro image comparing various attempts at obtaining or removing symmetry
number of cycles: 8, max marker size: 3456, m1: d, attempt at chaos
  1. ‘Gnarly’ curve using a single random or user selected shape for all wheels. Wheels: 3 (Circle). First 3 images at 1024 data points. The 4th at 2048 (I was curious).
spiro image comparing various attempts at obtaining or removing symmetry
number of cycles: 4, untouched
spiro image comparing various attempts at obtaining or removing symmetry
number of cycles: 4, attempt at symmetry
spiro image comparing various attempts at obtaining or removing symmetry
number of cycles: 4, attempt at chaos
spiro image comparing various attempts at obtaining or removing symmetry
number of cycles: 4, attempt at chaos, 2048 data points
  1. Simulated curve with cycling line width using scatter plot, single random wheel shape, random step size. Wheels: 3 (Circle). 2048 data points.
spiro image comparing various attempts at obtaining or removing symmetry
number of cycles: 4, max marker size: 9472, m1: 1, untouched
spiro image comparing various attempts at obtaining or removing symmetry
number of cycles: 4, max marker size: 7424, m1: D, attempt at symmetry
spiro image comparing various attempts at obtaining or removing symmetry
number of cycles: 4, max marker size: 7424, m1: 2, attempt at chaos

Reduce Symmetry II

Okay, going to try using two different sets of arrays containing random values for our sixteenths. The two will hopefully be sufficiently different 99% of the time. The code in get_gnarly_dset() now looks like the following. Well at least the parts that are currently relevant.

  global rwr, rwu, xwr, xwu

... 

  if do_sym and s_typ == 11:
    # random selection of 8 sixteenths reversed
    r_nx = list(range(0, 16))
    rwr = np.random.choice(r_nx, size=8, replace=False)
    t_1 = set(r_nx)
    t_2 = set(rwr)
    rwu = np.random.choice(list(t_1 - t_2), size=8, replace=False)
    if t_rx:
      xwr = np.random.choice(r_nx, size=8, replace=False)
      xwu = np.random.choice(list(t_1 - t_2), size=8, replace=False)
    print(f"sym 11: y data => reverse: {rwr}, unchanged: {rwu}; x data => {xwr}, {xwu}")
  else:
    rwr = []
    rwu = []
    xwr = []
    xwu = []

  for i, crv in enumerate(f_xs):
    if do_sym:
      f_y = get_sym_curve(f_ys[i], typ_s=s_typ, rwr=rwr, rwu=rwu)
      if s_typ == 11:
        if t_rx:
          f_x = get_sym_curve(crv, typ_s=s_typ, rwr=xwr, rwu=xwu)
        else:
          f_x = crv  
      else:
        f_x = get_sym_curve(crv, typ_s=s_typ, rwr=rwr, rwu=rwu)
    else:
      f_x = crv
      f_y = f_ys[i]

...

That variable t_rx is a new global variable I can flipflop at the command line to indicate whether I wish to alter only the y data (t_rx == False) or alter both the x and y data (t_rx == True). I am not going to show the related code. Very similar to plenty of previous examples. I am using global arrays so that I can print (to the command window) the values of the x and y random 16ths at a later point in the code’s execution.

Examples

Here are examples of this type of randomness for each of the images in the previous secton.

spiro image showing attempt to remove symmetry using different random order for x and y datasets
number of cycles: 8, max marker size: 5440, fig 1) above
spiro image showing attempt to remove symmetry using different random order for x and y datasets
number of cycles: 4, max marker size: 6400, fig 2) above
spiro image showing attempt to remove symmetry using different random order for x and y datasets
number of cycles: 4, max marker size: ?, fig 3) above
spiro image showing attempt to remove symmetry using different random order for x and y datasets
number of cycles: 4, fig 40 above
spiro image showing attempt to remove symmetry using different random order for x and y datasets
number of cycles: 4, max marker size: 10496, m1: 2, fig 5) above

Done

Had planned to look at one other thing in this post. But, it already has way too many images. And, has taken much too long to put together. That image processing takes some time.

Until next time, have fun, be happy.