Skip to content

danielhackl-tu/Superconductor_Critical_Temperature_Toolkit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

17T_Plots - Superconductor Critical Temperature Analysis

This project provides a comprehensive Python script for analyzing temperature-dependent transport measurements of superconducting samples. The script specializes in plotting measurement data and calculating critical temperatures using the tangent intersection method.

🎯 Project Overview

The 17T_plots.py script is designed to process experimental data from superconducting samples measured at various temperatures and magnetic fields. It automatically handles:

  • Temperature-dependent voltage measurements
  • Critical temperature (Tc) calculations using tangent intersection method
  • Publication-quality plotting with focused transition region views
  • Automatic temperature correction for measurements taken before sensor calibration
  • Support for multiple sample conditions (pristine, irradiated, annealed)

πŸš€ Features

Data Processing

  • Automatic Temperature Correction: Applies +0.45K correction to measurements taken before April 25, 2025
  • Multiple File Format Support: Handles tab-separated .dat files with temperature, voltage, and timestamp data
  • Flexible Data Input: Supports both custom folder paths and predefined sample selections

Analysis Capabilities

  • Critical Temperature Calculation: Uses tangent intersection method to determine Tc
  • Savitzky-Golay Filtering: Applies sophisticated smoothing for derivative calculations
  • Transition Region Detection: Automatically identifies superconducting transition regions
  • Dual Tc Values: Calculates both Tc_high (intersection) and Tc_low (x-intercept)

Visualization

  • Publication-Quality Plots: Generates high-resolution PDF outputs
  • Focused View: Automatically centers plots around transition regions
  • Color-Coded Analysis: Different colors for raw data, fits, and critical temperatures
  • Comprehensive Legends: Clear labeling of all plot elements

Sample Management

  • Condition Detection: Automatically identifies sample states from folder structure
  • Batch Processing: Can process multiple measurement files simultaneously
  • Flexible Naming: Supports custom sample names and automatic name extraction

πŸ“‹ Requirements

Install the required dependencies using pip:

pip install -r requirements.txt

Key Dependencies

  • matplotlib (3.9.4): For plotting and visualization
  • numpy (2.0.2): Numerical computations and array operations
  • pandas (2.2.3): Data manipulation and analysis
  • scipy (1.13.1): Scientific computing, especially Savitzky-Golay filtering
  • python-dateutil (2.9.0.post0): Timestamp parsing for temperature correction

πŸ› οΈ Installation

  1. Clone this repository:
git clone <repository-url>
cd 17T_Plots
  1. Install dependencies:
pip install -r requirements.txt
  1. Ensure your data follows the expected directory structure (see Data Format section)

πŸ“– Usage

Basic Usage

# Analyze a specific sample with critical temperature calculation
python 17T_plots.py --ISet_SPSCS09_020 --calculate-tc

# Plot a specific measurement file
python 17T_plots.py --ISet_SPSCS09_021 --file 1 --calculate-tc

# Use a custom folder path
python 17T_plots.py --folder "ISet_SPSCS09_021/IRR1/il" --sample "Sample 021 (irradiated)" --calculate-tc

Command Line Options

Option Description Example
--folder PATH Custom data folder path --folder "custom/path/il"
--ISet_SPSCS09_XXX Use predefined sample (018-025, 027, 028) --ISet_SPSCS09_020
--file NUMBER/all Plot specific file(s): 1, 2, 3, or "all" --file 1
--sample NAME Custom sample name for plot title --sample "My Sample"
--calculate-tc Calculate and display critical temperature --calculate-tc

Supported Samples

The script includes predefined paths for the following samples:

  • ISet_SPSCS09_018 through ISet_SPSCS09_025
  • ISet_SPSCS09_027
  • ISet_SPSCS09_028

πŸ“ Data Format

Expected File Structure

your_project/
β”œβ”€β”€ ISet_SPSCS09_XXX/
β”‚   β”œβ”€β”€ 0e22/              # Pristine samples
β”‚   β”‚   └── il/
β”‚   β”œβ”€β”€ 0e22-ann/          # Pristine & annealed samples
β”‚   β”‚   └── il/
β”‚   β”œβ”€β”€ IRR1/              # Irradiated samples
β”‚   β”‚   └── il/
β”‚   └── IRR1-ann/          # Irradiated & annealed samples
β”‚       └── il/
└── plots/                 # Output directory (auto-created)

Data File Format

The script expects .dat files with tab-separated columns:

  1. Temperature [K]: Measurement temperature
  2. Voltage [V]: Measured voltage
  3. Timestamp [ISO8601]: Measurement timestamp for temperature correction

Example data file (0.000000e+00T_1.dat):

# Temperature	Voltage	Timestamp
4.2000	1.234e-06	2025-03-15T10:30:00+01:00
4.1500	1.189e-06	2025-03-15T10:31:00+01:00
...

πŸ“Š Output Files

Plot Files

  • Location: plots/ directory (automatically created)
  • Format: High-resolution PDF files
  • Naming: {sample}_{condition}_0T_{file}_with_tc.pdf

Critical Temperature Results

  • Location: plots/ directory
  • Format: Text files with detailed Tc calculations
  • Naming: {sample}_{condition}_tc_results.txt

Example Output

Critical Temperature Results for SPSCS09 020 (pristine)
==================================================
File: 0.000000e+00T_1.dat
Tc_high: 4.157 K
Tc_low: 4.142 K
------------------------------

πŸ”¬ Scientific Methodology

Critical Temperature Calculation

The script implements a robust tangent intersection method:

  1. Data Smoothing: Applies Savitzky-Golay filter to reduce noise
  2. Derivative Calculation: Computes first derivative to identify transition steepness
  3. Region Identification:
    • Transition region: gradient > 60% of maximum
    • Resistive region: gradient < 30% of maximum
  4. Linear Fitting: Fits straight lines to both regions
  5. Tc Determination:
    • Tc_high: Intersection of transition and resistive fits
    • Tc_low: X-intercept of transition fit

Temperature Correction

For measurements taken before April 25, 2025, the script automatically applies a +0.45K correction to account for sensor calibration changes.

πŸ€– AI-Assisted Development

This project was developed with significant assistance from AI (GitHub Copilot and Claude), which helped with:

  • Algorithm Implementation: Critical temperature calculation using tangent intersection method
  • Data Processing Logic: Robust file parsing and timestamp handling
  • Code Structure: Modular design with clear separation of concerns
  • Error Handling: Comprehensive exception handling and data validation
  • Documentation: Detailed docstrings and comments throughout the code
  • Best Practices: Following Python coding standards and scientific computing conventions

The AI assistance was particularly valuable for:

  • Implementing the Savitzky-Golay filtering and derivative calculations
  • Developing the robust timestamp parsing with timezone awareness
  • Creating the flexible command-line interface
  • Optimizing the plotting aesthetics for publication-quality figures
  • Ensuring proper handling of edge cases in data processing

Human oversight ensured the scientific accuracy of the methods and validation against experimental requirements.

πŸ› οΈ Development Notes

Code Organization

  • Main Script: 17T_plots.py - Contains all functionality
  • Configuration: Command-line arguments for flexible usage
  • Output Management: Automatic directory creation and file naming

Key Functions

  • calculate_Tc(): Core critical temperature calculation
  • plot_cryostat_data(): Data visualization and plotting
  • parse_args(): Command-line argument handling

Error Handling

The script includes comprehensive error handling for:

  • Missing data files
  • Malformed data
  • Timestamp parsing failures
  • Insufficient data for fitting

πŸ“ License

This project is developed for scientific research purposes. Please cite appropriately if used in publications.

🀝 Contributing

Contributions are welcome! Please consider:

  • Adding support for additional file formats
  • Implementing alternative Tc calculation methods
  • Improving visualization options
  • Enhancing error handling

πŸ“ž Support

For questions about the scientific methodology or data format requirements, please refer to the detailed docstrings in the code or examine the example usage patterns provided.


This README was prepared with AI assistance to ensure comprehensive documentation of the project's capabilities and usage.

About

This project enables calculation of the critical temperature based on data collected by a 17T cryostat

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors