Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/SuziKim/DCCW
22 April 2026, 19:09:54 UTC
  • Code
  • Branches (2)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/deploy
    • refs/heads/main
    No releases to show
  • 72972bf
  • /
  • helper
  • /
  • generate_FM100P_dataset.py
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:b503ee33f025fd211bf7fa9b120662dd246db5a4
origin badgedirectory badge
swh:1:dir:7e038846ba5669f0317c06aa5c3516b81b2233fb
origin badgerevision badge
swh:1:rev:64aa7da56640747dd1317eb6319068361e8015c9
origin badgesnapshot badge
swh:1:snp:f3e011e3352a9f31a38ef03baf2d4e8b8085c8eb

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: 64aa7da56640747dd1317eb6319068361e8015c9 authored by suzikim on 18 August 2021, 18:05:41 UTC
change the initial palette for replicability stamp
Tip revision: 64aa7da
generate_FM100P_dataset.py
import os
import random
import time
import sys
import csv
sys.path.append(".")
sys.path.append("..")

from experiments.experiments_enums import *
from experiments.experiments_helper_functions import *

FM100P_full_colors = read_farnsworth_munsell_100()
palette_count_per_dataset = 100
neighbor_threshold = 5

gd_base_path = os.path.join('experiments', 'DCCW-dataset', 'FM100P')

def batch_palette_with_length(palette_length):
    random.seed(time.time())
    palette_indices = [random.randint(0, len(FM100P_full_colors)-1)]

    while len(palette_indices) < palette_length:
        # print('finding %d-th color' % len(palette_indices))
        random_color_index = random.randint(0, len(FM100P_full_colors)-1)

        if random_color_index in palette_indices:
            # print('\tfail to found %d-th color' % len(palette_indices))
            continue
        
        for index in palette_indices:
            if abs(index - random_color_index) <= neighbor_threshold:
                # print('\tfound %d-th color' % len(palette_indices))
                palette_indices.append(random_color_index)
                break

    return palette_indices


dir_name_base = 'FM100P-k%d'
file_name_base = 'FM100P-k%d-p%d.csv'

for FM100P_type in FM100PType:
    palettes_indices = []
    palette_length = FM100P_type.value

    dir_name = dir_name_base % palette_length
    os.makedirs(os.path.join(gd_base_path, dir_name, '%s-csv' % dir_name), exist_ok=True)

    while len(palettes_indices) < palette_count_per_dataset:
        print('finding %d-th palette' % len(palettes_indices))
        palette_indices = batch_palette_with_length(palette_length)
        palette_indices.sort()
        
        if palette_indices in palettes_indices:
            print('\tfail to found %d-th palette' % len(palettes_indices))
            continue

        print('\tfound %d-th palette' % len(palettes_indices))
        palettes_indices.append(palette_indices)

        file_name = file_name_base % (palette_length, len(palettes_indices)-1)
        with open(os.path.join(gd_base_path, dir_name, '%s-csv' % dir_name, file_name), 'w') as f:
            writer = csv.writer(f, delimiter='\t')
            shuffle_indices = random.sample(palette_indices, len(palette_indices))
            for index in shuffle_indices:
                writer.writerow([index, FM100P_full_colors[index]])
    

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API