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
Revision 4ce4daa0c1d4af7b6183a0f1a158e72b05b7abe9 authored by Jenny Wang on 15 December 2022, 15:53:27 UTC, committed by Jenny Wang on 15 December 2022, 15:53:27 UTC
First commit
0 parent
  • Files
  • Changes
    • Branches
    • Releases
    • HEAD
    • refs/heads/main
    • 4ce4daa0c1d4af7b6183a0f1a158e72b05b7abe9
    No releases to show
  • 4575c79
  • /
  • ecgs_at_output_times.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.

  • revision
  • directory
  • content
  • snapshot
origin badgerevision badge
swh:1:rev:4ce4daa0c1d4af7b6183a0f1a158e72b05b7abe9
origin badgedirectory badge
swh:1:dir:4575c7954cf67361d014d653628076424a446977
origin badgecontent badge
swh:1:cnt:f716d68832e74575e74fe53e7a0b59e2d05bf4ad
origin badgesnapshot badge
swh:1:snp:186a3806b6eb2061558f5264a47b071c2be0e794

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.

  • revision
  • directory
  • content
  • 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: 4ce4daa0c1d4af7b6183a0f1a158e72b05b7abe9 authored by Jenny Wang on 15 December 2022, 15:53:27 UTC
First commit
Tip revision: 4ce4daa
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)
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

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