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/jennyhelyanwe/post_MI_postprocessing
06 December 2024, 10:21:48 UTC
  • Code
  • Branches (1)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/main
    • 48c36cc0c5a8e853a4d97b18309493957e608091
    No releases to show
  • f27d72d
  • /
  • postprocessing_scripts
  • /
  • ecgs_at_output_times.py
Raw File Download
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 ...

Permalinks

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 Iframe embedding
swh:1:cnt:f716d68832e74575e74fe53e7a0b59e2d05bf4ad
origin badgedirectory badge Iframe embedding
swh:1:dir:a8a7d5884d0a84fa38356ad37ebde46e91c9e6ee
origin badgerevision badge
swh:1:rev:48c36cc0c5a8e853a4d97b18309493957e608091
origin badgesnapshot badge
swh:1:snp:186a3806b6eb2061558f5264a47b071c2be0e794
Citations

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
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: 48c36cc0c5a8e853a4d97b18309493957e608091 authored by Jenny on 03 December 2024, 11:43:08 UTC
Cell model copyright and clean version
Tip revision: 48c36cc
ecgs_at_output_times.py
from ECGPV_visualisation import *
import numpy
from matplotlib import pyplot as plt
from matplotlib.gridspec import GridSpec

a = ECGPV_visualisation(0.8)
ecgs = pickle.load(open('ecgs.pl', 'rb'), encoding='latin1')


def plot_ecg_to_specified_time(fig, ax, lead_name, t_end, counter):
    ax.clear()
    CL = 0.8
    beat = 3
    x_ = ecgs['ts'][beat-1]
    idx = [i for i,v in enumerate(x_) if v < t_end]
    x = x_[idx]
    xlabel = 'Time (s)'
    y_ = ecgs[lead_name+'s'][beat-1]/ecgs['max_all_leads']
    y = y_[idx]
    ylabel = lead_name
    ax.plot(x, y)
    ax.set_xlabel(xlabel)
    ax.set_ylabel(ylabel)
    print('setting ecg grids')
    a._set_ecg_ticks(ax, x_[-1], CL)
    ax.spines['top'].set_visible(False)
    ax.spines['right'].set_visible(False)
    ax.spines['bottom'].set_visible(False)
    ax.spines['left'].set_visible(False)
    ax.tick_params(left=False, right=False, top=False, bottom=False, labelleft=False, labelbottom=False)
    ax.set_xlim([0, numpy.ceil(x_[-1]/CL)*CL])
    plt.show(block = False)
    plt.savefig(lead_name+'_'+str(counter)+'.png')


# Get output times from .case file:
f = open('../displacement_local_strains/heart_remeshed_3D.ensi.case', 'r')
line = f.readline()
while line != 'TIME\n':
    line = f.readline()
line = f.readline()
time_set = line.split()[-1]
line = f.readline()
number_of_steps = float(line.split()[-1])
line = f.readline()
file_numbers = []
while len(file_numbers) < number_of_steps:
    line = f.readline()
    for i in range(0, len(line.split())):
        file_numbers.append(int(line.split()[i]))
junk = f.readline()
times = []
while len(times) < number_of_steps:
    line = f.readline()
    for i in range(0, len(line.split())):
        times.append(float(line.split()[i]))
times = numpy.array(times)
file_numbers = numpy.array(file_numbers)

# Plot ECGs
matplotlib.rcParams.update({'font.size':'24'})
matplotlib.rcParams.update({'text.color':'black'})
matplotlib.rcParams.update({'lines.linewidth':'3'})
fig_size = [5, 5]
fig = plt.figure(tight_layout=True, figsize=fig_size)
gs = GridSpec(1,1)
ax = fig.add_subplot(gs[0,0])
times = times - times[0]
for i in range(0, len(times)):
    for k in [1, 2, 3, 4, 5, 6]:
        plot_ecg_to_specified_time(fig, ax, 'V'+str(k), times[i], i)

Software Heritage — Copyright (C) 2015–2025, 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— Contact— JavaScript license information— Web API

back to top