You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was playing around with the new feature CLI.EXE , to see how if one can make or play with those numbers to make it visually appealing and perhaps useful to share online with other ALIEN users.
I let GPT analyze the output and I asked it to make sure we can control some min/max and also differentiate between the colors and sum them up into a hash table and we can display a pie chart.
Its very basic, not finished at all however GPT managed to produce a working python script that can read the output of the cli and visualize it.
This python script assumes the CSV file is called stats.csv , you can adjust the MIN_THRESHOLD to discard the small portions since these would clutter the chart quite negatively, other then that its just a test script so expect bugs and mistakes.
import csv
import matplotlib.pyplot as plt
# Define constants for columns in the CSV file
TIME_STEP_COL = 0
COLOR_COLUMNS_START = 1
MIN_THRESHOLD = 100000 # Adjust this threshold as needed
# Read data from the 'stats.csv' file
data = {}
colors = []
with open('stats.csv', newline='') as csvfile:
reader = csv.reader(csvfile)
headers = next(reader) # Read the header row
# Extract color names from the headers and remove leading spaces
colors = [color.strip() for color in headers[COLOR_COLUMNS_START:]]
# Initialize data dictionary with zeros for each color
for color in colors:
data[color] = [0] * len(headers[COLOR_COLUMNS_START:])
# Accumulate data for each time step
for row in reader:
for i, color in enumerate(colors):
data[color] = [sum(x) for x in zip(data[color], [float(val) for val in row[COLOR_COLUMNS_START:]])]
# Define attributes
attributes = headers[COLOR_COLUMNS_START:]
# Create pie charts for each color genome
for color in colors:
# Calculate attribute values for the current color genome
color_data = data[color]
# Filter attributes based on the threshold
filtered_attributes = [attr for attr, value in zip(attributes, color_data) if value >= MIN_THRESHOLD]
filtered_values = [value for value in color_data if value >= MIN_THRESHOLD]
# Create labels for slices
labels = filtered_attributes
# Create values for slices
values = filtered_values
# Create a pie chart only if there are significant values
if values:
plt.figure(figsize=(10, 6)) # Adjust figure size as needed
plt.pie(values, labels=labels, autopct='%1.1f%%', startangle=140)
plt.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle.
# Set title
plt.title(f'Genomes')
# Place legend outside the pie chart
plt.legend(labels, title="Attributes", bbox_to_anchor=(1.05, 1), loc='upper left')
plt.show()
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I was playing around with the new feature
CLI.EXE
, to see how if one can make or play with those numbers to make it visually appealing and perhaps useful to share online with other ALIEN users.I let GPT analyze the output and I asked it to make sure we can control some min/max and also differentiate between the colors and sum them up into a hash table and we can display a pie chart.
Its very basic, not finished at all however GPT managed to produce a working python script that can read the output of the cli and visualize it.
This python script assumes the
CSV
file is calledstats.csv
, you can adjust theMIN_THRESHOLD
to discard the small portions since these would clutter the chart quite negatively, other then that its just a test script so expect bugs and mistakes.Beta Was this translation helpful? Give feedback.
All reactions