File size: 2,820 Bytes
dc2b9f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env python3
"""
Test script for WrinkleBrane dataset creation (small version)
"""

import os
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent))

import numpy as np
from wrinklebrane_dataset_builder import WrinkleBraneDatasetBuilder

def test_small_dataset():
    print("πŸ§ͺ Testing WrinkleBrane Dataset Builder...")
    
    # Create builder with your token
    hf_token = "os.environ.get('HF_TOKEN', 'your-token-here')"
    repo_id = "WrinkleBrane"
    
    builder = WrinkleBraneDatasetBuilder(hf_token, repo_id)
    
    # Test visual memory generation
    print("πŸ‘οΈ Testing visual memory pairs...")
    visual_samples = builder.generate_visual_memory_pairs(5, H=32, W=32)
    print(f"βœ… Generated {len(visual_samples)} visual memory samples")
    
    # Test synthetic maps
    print("πŸ—ΊοΈ Testing synthetic maps...")
    map_samples = builder.generate_synthetic_maps(3, H=32, W=32)
    print(f"βœ… Generated {len(map_samples)} synthetic map samples")
    
    # Test interference studies
    print("⚑ Testing interference studies...")
    interference_samples = builder.generate_interference_studies(4, H=16, W=16)
    print(f"βœ… Generated {len(interference_samples)} interference samples")
    
    # Test orthogonality benchmarks
    print("πŸ“ Testing orthogonality benchmarks...")
    orthogonal_samples = builder.generate_orthogonality_benchmarks(2, L=16, K=16)
    print(f"βœ… Generated {len(orthogonal_samples)} orthogonality samples")
    
    # Test persistence traces
    print("⏰ Testing persistence traces...")
    persistence_samples = builder.generate_persistence_traces(3, H=16, W=16)
    print(f"βœ… Generated {len(persistence_samples)} persistence samples")
    
    # Show sample structure
    print("\nπŸ“Š Visual Memory Sample Structure:")
    if visual_samples:
        sample = visual_samples[0]
        for key, value in sample.items():
            if key in ["key_pattern", "value_pattern"]:
                arr = np.array(value)
                print(f"  {key}: shape {arr.shape}, range [{arr.min():.3f}, {arr.max():.3f}]")
            else:
                print(f"  {key}: {value}")
    
    print("\nπŸ“Š Interference Sample Structure:")
    if interference_samples:
        sample = interference_samples[0]
        for key, value in sample.items():
            if key in ["key_pattern", "value_pattern"]:
                arr = np.array(value)
                print(f"  {key}: shape {arr.shape}, range [{arr.min():.3f}, {arr.max():.3f}]")
            elif key not in ["key_pattern", "value_pattern"] and value is not None:
                print(f"  {key}: {value}")
    
    print("\nπŸŽ‰ All tests passed! WrinkleBrane dataset builder is working correctly.")
    return True

if __name__ == "__main__":
    test_small_dataset()