Skip to content

Instantly share code, notes, and snippets.

<%
require 'fort'
TYPES\
= ::Fort::Type::Logical.multi_provide(dim: (1..7))\
+ ::Fort::Type::Integer.multi_provide(dim: (1..7))\
+ ::Fort::Type::Real.multi_provide(dim: (1..7))\
+ ::Fort::Type::Complex.multi_provide(dim: (1..7))\
+ ::Fort::Type::Character.multi_provide(dim: (1..7))
@kshramt
kshramt / conv.F90
Created June 18, 2013 09:57
conv in time domain...
subroutine conv_iso_s(x, y, z)
! z = x*y のコンボリューションを計算する.
! x, y, z 全てのサンプリング間隔が等しいことを暗に仮定している.
! さらに言えば,本当はdx倍すべきなのに,していない。
real, intent(in):: x(:), y(:)
real, intent(out):: z(:)
integer:: nx, ny, nz
nx = size(x(:), 1)
ny = size(y(:), 1)
nz = size(z(:), 1)
import sys
import io
import numpy
import jinja2
import get_tick_configurations
import answer_dat
import moment_tensor
import numpy
import moment_tensor
class AnswerDat(object):
"""
If you update self.moment_rate_components, please run self.update_moment_rates().
"""
def __init__(self, path='answer.dat'):
import unittest
import plot_from
class PlotFromTest(unittest.TestCase):
def setUp(self):
pass
def test_mw_from_m0(self):
self.assertAlmostEqual(plot_from.mw_from_m0(1), -9.1/1.5)
import numpy
class Mrtf(object):
def __init__(self, rr, tt, ff, rt, rf, tf):
self.rr = rr
self.tt = tt
self.ff = ff
self.rt = rt
self.rf = rf
self.tf = tf
@kshramt
kshramt / sac_lib_test.F90
Created April 15, 2013 03:16
gfortran -ffree-line-length-none -fmax-identifier-length=63 -C sac_lib.F90 sac_lib_test.F90 -o sac_lib_test.exe && ./sac_lib_test.exe
program sac_lib_test
use, intrinsic:: iso_fortran_env, only: INPUT_UNIT, OUTPUT_UNIT, ERROR_UNIT
use:: sac_lib
implicit none
type(Sac):: w
Real(kind = SAC_REAL_KIND), allocatable:: body(:)
call set_iftype(w, 'itime') ! required
@kshramt
kshramt / sac_lib.F90
Last active December 16, 2015 05:38
This module provides - I/O routines for a binary SAC file. - user defined types to hold a SAC data - setters and getters for the Sac type.
#ifndef UTILS_HAVE_ALREADY_LOADED
# define UTILS_HAVE_ALREADY_LOADED
# define USE_UTILS_H use, intrinsic:: iso_fortran_env, only: ERROR_UNIT, OUTPUT_UNIT
# define WHERE_AM_I __FILE__, " ", __LINE__
# ifdef __GFORTRAN__
# define quote(x) "x"
# else
# ifdef __INTEL_COMPILER
# define quote(x) #x
# else
@kshramt
kshramt / utils.h
Last active October 13, 2015 18:07
#ifndef UTILS_HAVE_ALREADY_LOADED
# define UTILS_HAVE_ALREADY_LOADED
# define USE_UTILS_H use, intrinsic:: iso_fortran_env, only: ERROR_UNIT, OUTPUT_UNIT
# define WHERE_AM_I __FILE__, " ", __LINE__
# ifdef __GFORTRAN__
# define quote(x) "x"
# else
# ifdef __INTEL_COMPILER
# define quote(x) #x
# else
@kshramt
kshramt / lib_util.f90
Created July 23, 2012 18:10
Fortran 90 (and newer) utilities.
module lib_util
use, intrinsic:: iso_fortran_env, only: ERROR_UNIT
implicit none
private
public:: check
interface check
module procedure check_without_value