<jupyter_start><jupyter_text>Data visualization Here there are three different functions for getting a quick view to the opinions on a specific image in a certain workflow<jupyter_code>import pandas as pd
import json
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
from pylab import *
filename_classify = '/home/anna/Desktop/SUNDIAL/images/beta_space-fluff_classifications_clean.csv'
filename_onthego = '/home/anna/Desktop/SUNDIAL/images/beta_space-fluff_onthego_clean.csv'
filename_hardcore = '/home/anna/Desktop/SUNDIAL/images/beta_space-fluff_hardcore_clean.csv'
data_classify = pd.read_csv(filename_classify)
data_onthego = pd.read_csv(filename_onthego)
data_hardcore = pd.read_csv(filename_hardcore)
def answers_count(file, taskvalue, answer):
    howmany_answers = 0 
    for line in file[taskvalue]:
        if str(line).lower() == answer.lower():
            howmany_answers += 1
    return howmany_answers


def general_opinion_onthego(image_ID):
    
    image = '/home/anna/Desktop/SUNDIAL/images/beta/'+image_ID
    im = Image.open(image)
    imshow(im)

    file = data_onthego
    image_classifications = file.loc[file['subject_name_onthego'] == image_ID]
    
    total = len(image_classifications)
    galaxies = answers_count(image_classifications, 'taskvalue_T0_onthego', 'galaxy')
    clusters = answers_count(image_classifications, 'taskvalue_T0_onthego', 'Group of objects (cluster)')    
    other = answers_count(image_classifications, 'taskvalue_T0_onthego', 'Something else/empty center')  
 
    print('Here are the stats for the image: ', image_ID)
    
    print('Total numeber of votes: ', total)
    
    print('Number of votes for:')
    
    print('Galaxy: ', galaxies)
    print('Cluster: ', clusters)
    print('Something else: ', other)
 
   


def general_opinion_classify(image_ID):
    
    image = '/home/anna/Desktop/SUNDIAL/images/beta/'+image_ID
    im = Image.open(image)
    imshow(im)

    file = data_classify
    image_classifications = file.loc[file['subject_name_classify'] == image_ID]
    
    total = len(image_classifications)
    galaxies = answers_count(image_classifications, 'taskvalue_T0_classify', 'galaxy')
    clusters = answers_count(image_classifications, 'taskvalue_T0_classify', 'Group of objects (cluster)')    
    other = answers_count(image_classifications, 'taskvalue_T0_classify', 'Something else/empty center')  
    fluffs = answers_count(image_classifications, 'taskvalue_T1_classify', 'fluffy')  
    brights = answers_count(image_classifications, 'taskvalue_T1_classify', 'bright')  
    scattered = answers_count(image_classifications, 'taskvalue_T2_classify', 'Scattered light')  
    small_star = answers_count(image_classifications, 'taskvalue_T2_classify', 'looks like a small star') 
    nothing = answers_count(image_classifications, 'taskvalue_T2_classify', 'nothing: background too bright or galaxy too faint') 
    other_other = answers_count(image_classifications, 'taskvalue_T2_classify', 'something else') 
    
    print('Here are the stats for the image: ', image_ID)
    
    print('Total numeber of votes: ', total)
    
    print('Number of votes for:')
    
    print('Galaxy: ', galaxies)
    if galaxies > 0:
        print('\t Fluffy: ', fluffs)
        print('\t Bright: ', brights)
    print('Cluster: ', clusters)
    print('Something else: ', other)
    if other > 0:
        print('\t Scattered light: ', scattered)
        print('\t Looking like a small star: ', small_star)    
        print('\t Nothing: ', nothing)
        print('\t Something else: ', other_other)    
        
def general_opinion_hardcore(image_ID):
    
    image = '/home/anna/Desktop/SUNDIAL/images/beta/'+image_ID
    im = Image.open(image)
    imshow(im)

    file = data_hardcore
    image_classifications = file.loc[file['subject_name'] == image_ID]
    
    total = len(image_classifications)

    galaxies = answers_count(image_classifications, 'taskvalue_T0', 'galaxy')
    clusters = answers_count(image_classifications, 'taskvalue_T0', 'Group of objects (cluster)')    
    other = answers_count(image_classifications, 'taskvalue_T0', 'Something else/empty center')  

    red = answers_count(image_classifications, 'taskvalue_T1', 'Red/yellow')
    blue = answers_count(image_classifications, 'taskvalue_T1', 'white/blue')    
    impossible = answers_count(image_classifications, 'taskvalue_T1', 'impossible to say')     

    fluffs = answers_count(image_classifications, 'taskvalue_T2', 'fluffy')  
    brights = answers_count(image_classifications, 'taskvalue_T2', 'bright')  
    
    nocore = answers_count(image_classifications, 'taskvalue_T3', 'no/unsure')
    bright_core= answers_count(image_classifications, 'taskvalue_T3', 'yes, a bright point')    
    bulge = answers_count(image_classifications, 'taskvalue_T3', 'yes, a bulge')     

    rounds = answers_count(image_classifications, 'taskvalue_T4', 'round')
    elliptical = answers_count(image_classifications, 'taskvalue_T4', 'elliptical')    
    disturbed = answers_count(image_classifications, 'taskvalue_T4', 'distorted/disturbed')     
      
    dense = answers_count(image_classifications, 'taskvalue_T5', 'smooth and dense')
    fuzzy = answers_count(image_classifications, 'taskvalue_T5', 'smooth and fuzzy')    
    clumpy = answers_count(image_classifications, 'taskvalue_T5', 'clumpy and/or featured')     
      
    
    scattered = answers_count(image_classifications, 'taskvalue_T9', 'Scattered light')  
    small_star = answers_count(image_classifications, 'taskvalue_T9', 'looks like a small star') 
    nothing = answers_count(image_classifications, 'taskvalue_T9', 'nothing: background too bright or galaxy too faint') 
    other_other = answers_count(image_classifications, 'taskvalue_T9', 'something else') 
    
    print('Here are the stats for the image: ', image_ID)
    
    print('Total numeber of votes: ', total)
    
    print('Number of votes for:')
    
    print('Galaxy: ', galaxies)
    if galaxies > 0:
        print('\t The color:')
        print('\t \t Red/yellow: ', red)
        print('\t \t Blue/white: ', blue)
        print('\t \t Impossible to say: ', impossible)
        
        print('\t The perceived consistency: ')
        print('\t Fluffy: ', fluffs)
        print('\t Bright: ', brights)
 
        print('\t The core:')
        print('\t \t No core: ', nocore)
        print('\t \t Bright core: ', bright_core)
        print('\t \t Bulge: ', bulge)
 
        print('\t The shape:')
        print('\t \t Round: ', rounds)
        print('\t \t Elliptical: ', elliptical)
        print('\t \t Distorted/disturbed: ', disturbed)

        print('\t The texture:')
        print('\t \t Smooth and dense: ', dense)
        print('\t \t Smooth and fuzzy: ', fuzzy)
        print('\t \t Clumpy and/or featured: ', clumpy)
     
        
        
        
    print('Cluster: ', clusters)
    print('Something else: ', other)
    if other > 0:
        print('\t Scattered light: ', scattered)
        print('\t Looking like a small star: ', small_star)    
        print('\t Nothing: ', nothing)
        print('\t Something else: ', other_other)    
general_opinion_classify('UDGcand_15_insp.png')
general_opinion_onthego('UDGcand_15_insp.png')
general_opinion_hardcore('UDGcand_15_insp.png')
def bars(answers, how_many):
    fig = plt.figure()
    ax = fig.add_axes([0,0,1,1])
    ax.set_title('Answers', size = 20)
    ax.bar(answers, how_many, color = ['orange','lightseagreen', 'turquoise'])
    plt.show()
        
def bar_plot(file, taskvalue):
    
    other = answers_count(file, taskvalue,  'Something else/empty center')
    clusters = answers_count(file,  taskvalue,  'Group of objects (cluster)' )
    galaxies = answers_count(file,  taskvalue,  'Galaxy' )
    
    answers = ['Something else/empty center', 'Group of objects (cluster)',  'Galaxy']
    how_many = [other, clusters, galaxies]
    print(how_many)
    bars(answers, how_many)
    
bar_plot(data_onthego, 'taskvalue_T0_onthego')
bar_plot(data_classify, 'taskvalue_T0_classify')
bar_plot(data_hardcore, 'taskvalue_T0')<jupyter_output>[261, 808, 737]
{'fraction_non_alphanumeric': 0.11629330395397233, 'fraction_numerical': 0.007712082262210797, 'mean_word_length': 3.761072261072261, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '389088', 'license': 'MIT', 'n_tokens_mistral': 2671, 'n_tokens_neox': 2614, 'n_words': 574, 'path': 'SpaceFluff/DataViz.ipynb', 'repo_name': 'Seerden/SpaceFluff', 'size': '8169'}